Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to run 03_fwi.ipynb with GPU #2086

Open
yymss opened this issue Mar 10, 2023 · 4 comments
Open

Error when trying to run 03_fwi.ipynb with GPU #2086

yymss opened this issue Mar 10, 2023 · 4 comments
Labels

Comments

@yymss
Copy link

yymss commented Mar 10, 2023

Dear Devito team,

I am trying to run the tutorial notebook /devito/examples/seismic/tutorials/03_fwi.ipynb on my machine. It runs normally when using the CPU, but I would like to use the GPU. I tried setting %env DEVITO_PLATFORM=nvidiaX, but I encountered an error.

/tmp/devito-jitcache-uid1009/d3a3d2e6153c3468b5bd394c5b3e8c0ed9ec93cb.c: In function ‘initdamp’:
/tmp/devito-jitcache-uid1009/d3a3d2e6153c3468b5bd394c5b3e8c0ed9ec93cb.c:152:10: warning: ‘’ is used uninitialized in this function [-Wuninitialized]
152 | return 0;
| ^
/tmp/devito-jitcache-uid1009/d3a3d2e6153c3468b5bd394c5b3e8c0ed9ec93cb.c:152:10: warning: ‘’ is used uninitialized in this function [-Wuninitialized]
/tmp/devito-jitcache-uid1009/d3a3d2e6153c3468b5bd394c5b3e8c0ed9ec93cb.c:152:10: warning: ‘’ is used uninitialized in this function [-Wuninitialized]
/tmp/devito-jitcache-uid1009/d3a3d2e6153c3468b5bd394c5b3e8c0ed9ec93cb.c:152:10: warning: ‘’ is used uninitialized in this function [-Wuninitialized]
/tmp/devito-jitcache-uid1009/d3a3d2e6153c3468b5bd394c5b3e8c0ed9ec93cb.c:152:10: warning: ‘’ is used uninitialized in this function [-Wuninitialized]
/tmp/devito-jitcache-uid1009/d3a3d2e6153c3468b5bd394c5b3e8c0ed9ec93cb.c:152:10: warning: ‘’ is used uninitialized in this function [-Wuninitialized]
/tmp/devito-jitcache-uid1009/d3a3d2e6153c3468b5bd394c5b3e8c0ed9ec93cb.c:152:10: warning: ‘’ is used uninitialized in this function [-Wuninitialized]
/tmp/devito-jitcache-uid1009/d3a3d2e6153c3468b5bd394c5b3e8c0ed9ec93cb.c:152:10: warning: ‘’ is used uninitialized in this function [-Wuninitialized]
Output exceeds the size limit. Open the full output data in a text editor

CompileError Traceback (most recent call last)
Cell In[3], line 9
6 spacing = (10., 10.) # Grid spacing in m. The domain size is now 1km by 1km
7 origin = (0., 0.) # Need origin to define relative source and receiver locations
----> 9 model = demo_model('circle-isotropic', vp_circle=3.0, vp_background=2.5,
10 origin=origin, shape=shape, spacing=spacing, nbl=40)
12 model0 = demo_model('circle-isotropic', vp_circle=2.5, vp_background=2.5,
13 origin=origin, shape=shape, spacing=spacing, nbl=40,
14 grid = model.grid)
16 plot_velocity(model)

File ~/anaconda3/envs/demo/lib/python3.9/site-packages/examples/seismic/preset_models.py:247, in demo_model(preset, **kwargs)
244 y, x = np.ogrid[-a:shape[0]-a, -b:shape[1]-b]
245 v[xx + yy <= r*r] = vp
--> 247 return SeismicModel(space_order=space_order, vp=v, origin=origin, shape=shape,
248 dtype=dtype, spacing=spacing, nbl=nbl, bcs="damp",
249 fs=fs, **kwargs)
251 elif preset.lower() in ['marmousi-isotropic', 'marmousi2d-isotropic']:
252 shape = (1601, 401)

File ~/anaconda3/envs/demo/lib/python3.9/site-packages/examples/seismic/model.py:273, in SeismicModel.init(self, origin, spacing, shape, space_order, vp, nbl, fs, dtype, subdomains, bcs, grid, **kwargs)
271 def init(self, origin, spacing, shape, space_order, vp, nbl=20, fs=False,
272 dtype=np.float32, subdomains=(), bcs="mask", grid=None, **kwargs):
--> 273 super(SeismicModel, self).init(origin, spacing, shape, space_order, nbl,
...
208 print("FAILED compiler invocation:" + " ".join(cc_cmdline),
209 file=sys.stderr)
--> 210 raise CompileError("module compilation failed")

CompileError: module compilation failed

I have read some issues and set %env DEVITO_ARCH=gcc but still filled.
Thank you for your help.

Best regards,
yym

@mloubout
Copy link
Contributor

To run on nvidia gpus with DEVITO_PLATFORM=nvidiaX you need to set the arch and language to valid ones, namely DEVITO_LANGUAGE=openmp with DEVITO_ARCH=nvc or DEVITO_LANGUAGE=openacc with DEVITO_ARCH=nvc

You can also use clang instead of nvc if you built llvm yourself to support openmp/openacc offloading

@yymss
Copy link
Author

yymss commented Mar 11, 2023

Thank you for your help! I’m new to NVIDIA and Devito. I have added %env DEVITO_PLATFORM=nvidiaX %env DEVITO_LANGUAGE=openacc %env DEVITO_ARCH = nvc and got the nvc++ compiler isn't available on this system Do I need to install the NVIDIA HPC SDK to use GPU on DeVito?

@mloubout
Copy link
Contributor

Yes you will need either the SDK or another way to get the Nvidia compiler suite

@mloubout mloubout added the GPU label Mar 20, 2023
@georgebisbas
Copy link
Contributor

Maybe this can be closed? Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants