[petsc-dev] CUDA STREAMS

Mills, Richard Tran rtmills at anl.gov
Wed Oct 2 15:26:32 CDT 2019


Mark,

It looks like you are missing some critical CUDA library (or libraries) in your link line. I know you will at least need the CUDA runtime "-lcudart". Look at something like PETSC_WITH_EXTERNAL_LIB for one of your CUDA-enabled PETSc builds in $PETSC_ARCH/lib/petsc/conf/petscvariables to see what else you might need.

--Richard

On 10/2/19 7:20 AM, Mark Adams via petsc-dev wrote:

I found a CUDAVersion.cu of STREAMS and tried to build it. I got it to compile manually with:

nvcc -o CUDAVersion.o -ccbin pgc++ -I/autofs/nccs-svm1_sw/summit/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/pgi-19.4/spectrum-mpi-10.3.0.1-20190611-4ymaahbai7ehhw4rves5jjiwon2laz3a/include -Wno-deprecated-gpu-targets -c --compiler-options="-g -I/ccs/home/adams/petsc/include -I/ccs/home/adams/petsc/arch-summit-opt64-pgi-cuda/include   " `pwd`/CUDAVersion.cu
/gpfs/alpine/geo127/scratch/adams/CUDAVersion.cu(22): warning: conversion from a string literal to "char *" is deprecated
 ....

And this did produce a .o file. But I get this when I try to link.

make -f makestreams CUDAVersion
mpicc -g -fast  -o CUDAVersion CUDAVersion.o -Wl,-rpath,/ccs/home/adams/petsc/arch-summit-opt64-pgi-cuda/lib -L/ccs/home/adams/petsc/arch-summit-opt64-pgi-cuda/lib -Wl,-rpath,/ccs/home/adams/petsc/arch-summit-opt64-pgi-cuda/lib -L/ccs/home/adams/petsc/arch-summit-opt64-pgi-cuda/lib /autofs/nccs-svm1_sw/summit/.swci/0-core/opt/spack/20180914/linux-rhel7-ppc64le/gcc-4.8.5/pgi-19.4-6acz4xyqjlpoaonjiiqjme2aknrfnzoy/linuxpower/19.4/lib/pgi.ld -Wl,-rpath,/autofs/nccs-svm1_sw/summit/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/pgi-19.4/spectrum-mpi-10.3.0.1-20190611-4ymaahbai7ehhw4rves5jjiwon2laz3a/lib -L/autofs/nccs-svm1_sw/summit/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/pgi-19.4/spectrum-mpi-10.3.0.1-20190611-4ymaahbai7ehhw4rves5jjiwon2laz3a/lib -Wl,-rpath,/autofs/nccs-svm1_sw/summit/.swci/0-core/opt/spack/20180914/linux-rhel7-ppc64le/gcc-4.8.5/pgi-19.4-6acz4xyqjlpoaonjiiqjme2aknrfnzoy/linuxpower/19.4/lib -L/autofs/nccs-svm1_sw/summit/.swci/0-core/opt/spack/20180914/linux-rhel7-ppc64le/gcc-4.8.5/pgi-19.4-6acz4xyqjlpoaonjiiqjme2aknrfnzoy/linuxpower/19.4/lib -Wl,-rpath,/usr/lib/gcc/ppc64le-redhat-linux/4.8.5 -L/usr/lib/gcc/ppc64le-redhat-linux/4.8.5 -lpetsc -llapack -lblas -lparmetis -lmetis -lstdc++ -ldl -lpthread -lmpiprofilesupport -lmpi_ibm_usempi -lmpi_ibm_mpifh -lmpi_ibm -lpgf90rtl -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgftnrtl -latomic -lpgkomp -lomp -lomptarget -lpgmath -lpgc -lrt -lmass_simdp9 -lmassvp9 -lmassp9 -lm -lgcc_s -lstdc++ -ldl
CUDAVersion.o: In function `setupStream(long, PetscBool, PetscBool)':
/gpfs/alpine/geo127/scratch/adams/CUDAVersion.cu:394: undefined reference to `cudaGetDeviceCount'
/gpfs/alpine/geo127/scratch/adams/CUDAVersion.cu:406: undefined reference to `cudaSetDevice'
 ....

I have compared this link line with working examples and it looks the same. There is not .c file here -- main is in the .cu file. I assume that is the difference.

Any ideas?
Thanks,
Mark

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20191002/a44ef220/attachment.html>


More information about the petsc-dev mailing list