Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pystencils_autodiff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
pycodegen
pystencils_autodiff
Commits
cc241ab5
Commit
cc241ab5
authored
5 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Only link cudart if using CUDA
parent
7f6047b1
No related branches found
No related tags found
No related merge requests found
Pipeline
#18888
failed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pystencils_autodiff/tensorflow_jit.py
+19
-5
19 additions, 5 deletions
src/pystencils_autodiff/tensorflow_jit.py
with
19 additions
and
5 deletions
src/pystencils_autodiff/tensorflow_jit.py
+
19
−
5
View file @
cc241ab5
...
...
@@ -50,7 +50,11 @@ else:
_link_cudart
=
'
/link cudart
'
# ???
def
link
(
object_files
,
destination_file
=
None
,
overwrite_destination_file
=
True
,
additional_link_flags
=
[]):
def
link
(
object_files
,
destination_file
=
None
,
overwrite_destination_file
=
True
,
additional_link_flags
=
[],
link_cudart
=
True
):
"""
Compiles given :param:`source_file` to a Tensorflow shared Library.
.. warning::
...
...
@@ -69,7 +73,6 @@ def link(object_files, destination_file=None, overwrite_destination_file=True, a
*
tf
.
sysconfig
.
get_link_flags
(),
*
_include_flags
,
*
additional_link_flags
,
_link_cudart
,
_shared_object_flag
,
_output_flag
]
if
not
destination_file
:
...
...
@@ -78,15 +81,25 @@ def link(object_files, destination_file=None, overwrite_destination_file=True, a
if
not
exists
(
destination_file
)
or
overwrite_destination_file
:
command
=
command_prefix
+
[
destination_file
]
if
link_cudart
:
command
.
append
(
_link_cudart
)
subprocess
.
check_call
(
command
,
env
=
_compile_env
)
return
destination_file
def
link_and_load
(
object_files
,
destination_file
=
None
,
overwrite_destination_file
=
True
,
additional_link_flags
=
[]):
def
link_and_load
(
object_files
,
destination_file
=
None
,
overwrite_destination_file
=
True
,
additional_link_flags
=
[],
link_cudart
=
True
):
import
tensorflow
as
tf
destination_file
=
link
(
object_files
,
destination_file
,
overwrite_destination_file
,
additional_link_flags
)
destination_file
=
link
(
object_files
,
destination_file
,
overwrite_destination_file
,
additional_link_flags
,
link_cudart
)
lib
=
tf
.
load_op_library
(
destination_file
)
return
lib
...
...
@@ -197,7 +210,8 @@ def compile_sources_and_load(host_sources,
print
(
'
Linking Tensorflow module...
'
)
module_file
=
link
(
object_files
,
overwrite_destination_file
=
False
,
additional_link_flags
=
additional_link_flags
)
additional_link_flags
=
additional_link_flags
,
link_cudart
=
cuda_sources
)
if
not
compile_only
:
module
=
tf
.
load_op_library
(
module_file
)
if
module
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment