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
6aace600
Commit
6aace600
authored
5 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Let all Tensorflow compilation test pass by using different function
names
parent
5782627b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#17927
failed
5 years ago
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_native_tensorflow_compilation.py
+6
-6
6 additions, 6 deletions
tests/test_native_tensorflow_compilation.py
tests/test_tensorflow_jit.py
+15
-16
15 additions, 16 deletions
tests/test_tensorflow_jit.py
with
21 additions
and
22 deletions
tests/test_native_tensorflow_compilation.py
+
6
−
6
View file @
6aace600
...
@@ -108,9 +108,9 @@ def test_native_tensorflow_compilation_gpu():
...
@@ -108,9 +108,9 @@ def test_native_tensorflow_compilation_gpu():
backward_assignments
=
create_backward_assignments
(
forward_assignments
)
backward_assignments
=
create_backward_assignments
(
forward_assignments
)
forward_ast
=
pystencils
.
create_kernel
(
forward_assignments
,
target
)
forward_ast
=
pystencils
.
create_kernel
(
forward_assignments
,
target
)
forward_ast
.
function_name
=
'
forward
'
forward_ast
.
function_name
=
'
forward
2
'
backward_ast
=
pystencils
.
create_kernel
(
backward_assignments
,
target
)
backward_ast
=
pystencils
.
create_kernel
(
backward_assignments
,
target
)
backward_ast
.
function_name
=
'
backward
'
backward_ast
.
function_name
=
'
backward
2
'
module
=
TensorflowModule
(
module_name
,
[
forward_ast
,
backward_ast
])
module
=
TensorflowModule
(
module_name
,
[
forward_ast
,
backward_ast
])
print
(
str
(
module
))
print
(
str
(
module
))
...
@@ -144,10 +144,10 @@ def test_native_tensorflow_compilation_gpu():
...
@@ -144,10 +144,10 @@ def test_native_tensorflow_compilation_gpu():
# command = ['clang-7', '-shared', temp_file.name, '--cuda-path=/usr/include', '-std=c++14',
# command = ['clang-7', '-shared', temp_file.name, '--cuda-path=/usr/include', '-std=c++14',
# '-fPIC', '-lcudart', '-o', 'foo.so'] + compile_flags + link_flags + extra_flags
# '-fPIC', '-lcudart', '-o', 'foo.so'] + compile_flags + link_flags + extra_flags
command
=
[
'
c++
'
,
'
-fPIC
'
,
'
-lcudart
'
,
'
foo_gpu.o
'
,
command
=
[
'
c++
'
,
'
-fPIC
'
,
'
-lcudart
'
,
'
foo_gpu.o
'
,
'
-shared
'
,
'
-o
'
,
'
foo.so
'
]
+
link_flags
'
-shared
'
,
'
-o
'
,
'
foo
_gpu
.so
'
]
+
link_flags
subprocess
.
check_call
(
command
)
subprocess
.
check_call
(
command
)
lib
=
tf
.
load_op_library
(
join
(
os
.
getcwd
(),
'
foo.so
'
))
lib
=
tf
.
load_op_library
(
join
(
os
.
getcwd
(),
'
foo
_gpu
.so
'
))
assert
'
call_forward
'
in
dir
(
lib
)
assert
'
call_forward
2
'
in
dir
(
lib
)
assert
'
call_backward
'
in
dir
(
lib
)
assert
'
call_backward
2
'
in
dir
(
lib
)
This diff is collapsed.
Click to expand it.
tests/test_tensorflow_jit.py
+
15
−
16
View file @
6aace600
...
@@ -17,13 +17,13 @@ from pystencils_autodiff import create_backward_assignments
...
@@ -17,13 +17,13 @@ from pystencils_autodiff import create_backward_assignments
from
pystencils_autodiff.backends.astnodes
import
TensorflowModule
from
pystencils_autodiff.backends.astnodes
import
TensorflowModule
def
test_tensorflow_jit_
c
pu
():
def
test_tensorflow_jit_
g
pu
():
pytest
.
importorskip
(
'
tensorflow
'
)
pytest
.
importorskip
(
'
tensorflow
'
)
module_name
=
"
Ololol
"
module_name
=
"
Ololol
s
"
target
=
'
c
pu
'
target
=
'
g
pu
'
z
,
y
,
x
=
pystencils
.
fields
(
"
z, y, x: [20,40]
"
)
z
,
y
,
x
=
pystencils
.
fields
(
"
z, y, x: [20,40]
"
)
a
=
sympy
.
Symbol
(
'
a
'
)
a
=
sympy
.
Symbol
(
'
a
'
)
...
@@ -35,23 +35,23 @@ def test_tensorflow_jit_cpu():
...
@@ -35,23 +35,23 @@ def test_tensorflow_jit_cpu():
backward_assignments
=
create_backward_assignments
(
forward_assignments
)
backward_assignments
=
create_backward_assignments
(
forward_assignments
)
forward_ast
=
pystencils
.
create_kernel
(
forward_assignments
,
target
)
forward_ast
=
pystencils
.
create_kernel
(
forward_assignments
,
target
)
forward_ast
.
function_name
=
'
forward
'
forward_ast
.
function_name
=
'
forward
_jit_gpu
'
# must be different from CPU names
backward_ast
=
pystencils
.
create_kernel
(
backward_assignments
,
target
)
backward_ast
=
pystencils
.
create_kernel
(
backward_assignments
,
target
)
backward_ast
.
function_name
=
'
backward
'
backward_ast
.
function_name
=
'
backward
_jit_gpu
'
module
=
TensorflowModule
(
module_name
,
[
forward_ast
,
backward_ast
])
module
=
TensorflowModule
(
module_name
,
[
forward_ast
,
backward_ast
])
lib
=
pystencils_autodiff
.
tensorflow_jit
.
compile_sources_and_load
([
str
(
module
)])
lib
=
pystencils_autodiff
.
tensorflow_jit
.
compile_sources_and_load
(
[],
[
str
(
module
)])
assert
'
call_forward
'
in
dir
(
lib
)
assert
'
call_forward
_jit_gpu
'
in
dir
(
lib
)
assert
'
call_backward
'
in
dir
(
lib
)
assert
'
call_backward
_jit_gpu
'
in
dir
(
lib
)
def
test_tensorflow_jit_
g
pu
():
def
test_tensorflow_jit_
c
pu
():
pytest
.
importorskip
(
'
tensorflow
'
)
pytest
.
importorskip
(
'
tensorflow
'
)
module_name
=
"
Ololol
"
module_name
=
"
Ololol
"
target
=
'
g
pu
'
target
=
'
c
pu
'
z
,
y
,
x
=
pystencils
.
fields
(
"
z, y, x: [20,40]
"
)
z
,
y
,
x
=
pystencils
.
fields
(
"
z, y, x: [20,40]
"
)
a
=
sympy
.
Symbol
(
'
a
'
)
a
=
sympy
.
Symbol
(
'
a
'
)
...
@@ -63,12 +63,11 @@ def test_tensorflow_jit_gpu():
...
@@ -63,12 +63,11 @@ def test_tensorflow_jit_gpu():
backward_assignments
=
create_backward_assignments
(
forward_assignments
)
backward_assignments
=
create_backward_assignments
(
forward_assignments
)
forward_ast
=
pystencils
.
create_kernel
(
forward_assignments
,
target
)
forward_ast
=
pystencils
.
create_kernel
(
forward_assignments
,
target
)
forward_ast
.
function_name
=
'
forward
'
forward_ast
.
function_name
=
'
forward
_jit
'
backward_ast
=
pystencils
.
create_kernel
(
backward_assignments
,
target
)
backward_ast
=
pystencils
.
create_kernel
(
backward_assignments
,
target
)
backward_ast
.
function_name
=
'
backward
'
backward_ast
.
function_name
=
'
backward
_jit
'
module
=
TensorflowModule
(
module_name
,
[
forward_ast
,
backward_ast
])
module
=
TensorflowModule
(
module_name
,
[
forward_ast
,
backward_ast
])
lib
=
pystencils_autodiff
.
tensorflow_jit
.
compile_sources_and_load
([],
[
str
(
module
)])
lib
=
pystencils_autodiff
.
tensorflow_jit
.
compile_sources_and_load
([
str
(
module
)])
assert
'
call_forward
'
in
dir
(
lib
)
assert
'
call_forward_jit
'
in
dir
(
lib
)
assert
'
call_backward
'
in
dir
(
lib
)
assert
'
call_backward_jit
'
in
dir
(
lib
)
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