Skip to content

Commit

Permalink
Check if inside a module or not
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzomammana committed Apr 26, 2020
1 parent a508ac9 commit aebd10c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions morphology_cupy.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import cupy as cp
import numpy as np

with open('morph_cupy/morphology.cu', 'r') as f:
code = f.read()
try:
with open('morphology.cu', 'r') as f:
code = f.read()
except FileNotFoundError:
with open('morph_cupy/morphology.cu', 'r') as f:
code = f.read()

module = cp.RawModule(code=code)
dilation_cuda = module.get_function('dilation')
Expand Down

0 comments on commit aebd10c

Please sign in to comment.