mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Msieve (https://www.mersenneforum.org/forumdisplay.php?f=83)
-   -   compiling msieve w/ latest CUDA? (https://www.mersenneforum.org/showthread.php?t=25101)

mathwiz 2020-01-09 16:16

compiling msieve w/ latest CUDA?
 
On an Ubuntu 18.04 system with the latest msieve checked out from SVN, and CUDA 10, I get a bunch of build errors, e.g.

[code]nvcc fatal : Value 'sm_20' is not defined for option 'gpu-architecture'[/code]

Even after removing stage1_core_sm20.ptx from the top-level Makefile, I get more errors in the cub/ subdirectory.

Has anyone recently built msieve w/ CUDA on a recent Ubuntu system with CUDA 10? Or suggestions on how to fix up the various Makefiles to build?

jasonp 2020-01-10 02:32

Compute capability 2.0 is not supported in latter-day versions of CUDA (9.1 and up I think). You also need to change the CUB compile line near the bottom of the Msieve makefile to remove the '200' from the 'sm=...' compile argument.

There may also be trouble with the paths to CUDA binaries and libs, my experience is that the layout of the CUDA install directories occasionally changes.

EdH 2020-01-11 15:39

I'm trying to get a CUDA build running in Colab. I think I've removed all the 2.0 references, but I have the following error:
[code]
"/usr/local/cuda/bin/nvcc" -arch sm_30 -ptx -o stage1_core_sm30.ptx gnfs/poly/stage1/stage1_core_gpu/stage1_core.cu
"/usr/local/cuda/bin/nvcc" -arch sm_35 -ptx -o stage1_core_sm35.ptx gnfs/poly/stage1/stage1_core_gpu/stage1_core.cu
"/usr/local/cuda/bin/nvcc" -arch sm_50 -ptx -o stage1_core_sm50.ptx gnfs/poly/stage1/stage1_core_gpu/stage1_core.cu
cd cub && make WIN=0 WIN64=0 sm=300,350,520 && cd ..
make[1]: Entering directory '/content/msieve/cub'
"/usr/local/cuda/bin/nvcc" -gencode=arch=compute_52,code=\"sm_52,compute_52\" -gencode=arch=compute_35,code=\"sm_35,compute_35\" -gencode=arch=compute_30,code=\"sm_30,compute_30\" -DSM520 -DSM350 -DSM300 -o sort_engine.so sort_engine.cu -Xptxas -v -Xcudafe -# -shared -Xptxas -abi=no -Xcompiler -fPIC -Xcompiler -fvisibility=hidden -I"/usr/local/cuda/bin/..//include" -I. -O3
Front end time 0.76 (CPU) 1.00 (elapsed)
Back end time 0.04 (CPU) 0.00 (elapsed)
Total compilation time 0.81 (CPU) 1.00 (elapsed)
Front end time 0.99 (CPU) 1.00 (elapsed)
Back end time 0.06 (CPU) 0.00 (elapsed)
Total compilation time 1.07 (CPU) 1.00 (elapsed)
ptxas error : Invalid value 'no' for option -abi.
ptxas fatal : Ptx assembly aborted due to errors
Makefile:75: recipe for target 'sort_engine.so' failed
make[1]: *** [sort_engine.so] Error 255
make[1]: Leaving directory '/content/msieve/cub'
Makefile:347: recipe for target 'cub/built' failed
make: *** [cub/built] Error 2
[/code]Thoughts?

chris2be8 2020-01-11 16:46

On my newest system I got it running with:
[code]
chris@sirius:~$ diff msieve.1030/trunk/Makefile msieve.1030.cuda/trunk/Makefile
198a199
> # stage1_core_sm20.ptx
200d200
< stage1_core_sm20.ptx \
337,338c337,338
< stage1_core_sm20.ptx: $(NFS_GPU_HDR)
< $(NVCC) -arch sm_20 -ptx -o $@ $<
---
> #stage1_core_sm20.ptx: $(NFS_GPU_HDR)
> # $(NVCC) -arch sm_20 -ptx -o $@ $<
350c350
< cd cub && make WIN=$(WIN) WIN64=$(WIN64) sm=200,300,350,520 && cd ..
---
> cd cub && make WIN=$(WIN) WIN64=$(WIN64) sm=300,350,520 && cd ..
[/code]

[code]
chris@sirius:~$ diff msieve.1030/trunk/cub/Makefile msieve.1030.cuda/trunk/cub/Makefile
19c19
< NVCCFLAGS += -Xptxas -v -Xcudafe -\# -shared -Xptxas -abi=no \
---
> NVCCFLAGS += -Xptxas -v -Xcudafe -\# -shared \
45,52d44
< endif
< ifeq (210, $(findstring 210, $(SM_ARCH)))
< SM_TARGETS += -gencode=arch=compute_20,code=\"sm_21,compute_20\"
< SM_DEF += -DSM210
< endif
< ifeq (200, $(findstring 200, $(SM_ARCH)))
< SM_TARGETS += -gencode=arch=compute_20,code=\"sm_20,compute_20\"
< SM_DEF += -DSM200
[/code]

Chris

chris2be8 2020-01-12 16:47

The thing you need to do is remove -Xptxas -abi=no from NVCCFLAGS. -Xptxas tells nvcc that the parameter following it is to be passed to ptxas. Similarly -Xcompiler for parameters passed to the C compiler. So if you just remove -abi=no nvcc will take the next parameter, -Xcompiler, as to be passed to ptxas, then complain about -fPIC. This took me a while to figure out (eventually finding and reading the right manual cracked it).

I hope this saves someone a bit of puzzling.

Chris


All times are UTC. The time now is 15:57.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.