isce2 icon indicating copy to clipboard operation
isce2 copied to clipboard

PyCuAmpcor: compile files as pure C++ when possible, fix Makefile

Open rtburns-jpl opened this issue 3 years ago • 2 comments

cc @lijun99

rtburns-jpl avatar Nov 15 '22 22:11 rtburns-jpl

Thanks, @rtburns-jpl ! Looks good to me. I understand the changes will make interfacing with python easier. BTW, maybe we should abandon the Makefile, and use a CMakeLists.txt.standalone instead, such as, https://github.com/lijun99/cuAmpcor/blob/main/CMakeLists.txt

lijun99 avatar Nov 16 '22 01:11 lijun99

For sure, I like CMake much better. I wasn't sure where to put a standalone CMakeLists.txt since there is already the project's CMakeLists.txt in this directory, but I suppose we could either put a standalone one in src/, or figure out how to make the existing one work standalone as well. For now, I think I'll merge this, so that we have at least something working.

rtburns-jpl avatar Nov 16 '22 01:11 rtburns-jpl

@rtburns-jpl , I was able to get this setup on my end, but encounter a bug I'm not sure how to address. Could you please advise? Thanks:

(pyampcor) [ssangha@trappist merged]$ cuDenseOffsets.py -r SLC/20221004/20221004.slc.full -s SLC/20221016/20221016.slc.full --outprefix ./20151120_20151214/offset --ww 64 --wh 64 --oo 32 --kw 300 --kh 100 --nwac 32 --nwdc 1 --sw 20 --sh 20 --gpuid 2 This is the Open Source version of ISCE. Some of the workflows depend on a separate licensed package. To obtain the licensed package, please make a request for ISCE through the website: https://download.jpl.nasa.gov/ops/request/index.cfm. Alternatively, if you are a member, or can become a member of WinSAR you may be able to obtain access to a version of the licensed sofware at https://winsar.unavco.org/software/isce ./20151120_20151214/offset API open (R): /u/trappist-r0/ssangha/CA/A064/merged/SLC/20221016/20221016.slc.full API open (R): /u/trappist-r0/ssangha/CA/A064/merged/SLC/20221004/20221004.slc.full deramp method (0 for magnitude, 1 for complex): 0 image length: 4178 image width: 21577 the number of windows: 40 by 71 window size for cross-correlation: 64 by 64 initial search range: 20 by 20 the first pixel in reference image is: (20, 20) search step: 100 by 300 correlation surface zoom-in window size: 16 correlation surface oversampling factor: 32 offsetfield: ./20151120_20151214/offset.bip gross offsetfield: ./20151120_20151214/offset_gross.bip snr: ./20151120_20151214/offset_snr.bip cov: ./20151120_20151214/offset_cov.bip Set constant grossOffset (0, 0) redo: False Running PyCuAmpcor gpuDeviceInit() Device 2 is not a valid GPU device.

sssangha avatar Dec 20 '22 22:12 sssangha

"--gpuid 2" is to choose the gpu device with id=2 if you have multiple gpus. Please use "nvidia-smi" to check the available gpus on your computer. If you only have one, please use "--gpuid 0" or simply neglect this setting (since gpuid=0 is the default setting).

lijun99 avatar Dec 20 '22 23:12 lijun99

Thanks @lijun99 , that part was an input error on my end! However after making the suggested commandline adjustment, I encounter a new error along the same part of the routine:

Total number of windows (azimuth x range): 40 x 71 to be processed in the number of chunks: 40 x 3 Processing chunks (1, x) - (4, x) out of 40 cuArraysCopy.cu(141) : CUDA error : cuArraysCopyToBatchAbsWithOffset_kernel : (209) no kernel image is available for execution on the device.

I have the impression that the parameters I specified in my Makefile may not have been appropriate.

For reference, here is my available GPU:

(pyampcor) [ssangha@trappist merged]$ nvidia-smi Tue Dec 20 16:41:17 2022
+-----------------------------------------------------------------------------+ | NVIDIA-SMI 510.39.01 Driver Version: 510.39.01 CUDA Version: 11.6 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 NVIDIA A100 80G... Off | 00000000:41:00.0 Off | 0 | | N/A 31C P0 42W / 300W | 0MiB / 81920MiB | 0% Default | | | | Disabled | +-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+

Could you perhaps advise on what may be the issue here, be it may on the Makefile level or otherwise? Thanks again!

sssangha avatar Dec 21 '22 00:12 sssangha

I think you just need to add the appropriate compute version for your device here

https://github.com/isce-framework/isce2/blob/9457a34b4b4a4228df877c3e9618def162511d32/contrib/PyCuAmpcor/src/Makefile#L9-L10

rtburns-jpl avatar Dec 21 '22 00:12 rtburns-jpl