[cfe-dev] CUDA Compilation Issue - Possible bug?
Lorenz Braun via cfe-dev
cfe-dev at lists.llvm.org
Tue Aug 29 01:54:01 PDT 2017
Hi there,
i am currently using clang/clang++ to compile the CUDA part of the
rodinia benchmarksuite [0]. Besides some already known bugs regarding
the use of texture memory [1],[2] i have found another problem. It is
only occurring for the CUDA version of the streamcluster application.
Here is how the application is compiled:
clang++ --cuda-path=/opt/cuda-8.0 -lcudart -I/opt/cuda-8.0/include -O3
streamcluster_cuda_cpu.cpp streamcluster_cuda.cu streamcluster_header.cu
-o sc_gpu
This leads to several errors with the new and delete operator defines in
the cuda_wrapper of clang (see attachment).
There is a workaround though. Compiling the source files in separate
objects and linking them afterwards works just fine. Therefore i am not
sure if this might be a bug.
What do you think?
Regards
Lorenz
[0] https://www.cs.virginia.edu/~skadron/wiki/rodinia/index.php/Main_Page
[1] https://bugs.llvm.org/show_bug.cgi?id=30250
[2] https://bugs.llvm.org/show_bug.cgi?id=26400
--
Lorenz Braun
Research Associate
Institute of Computer Engineering (ZITI)
B6, 26, Building B, Office B2.20
68131 Mannheim
Phone: +49-621-181-2696
lorenz.braun at ziti.uni-heidelberg.de
-------------- next part --------------
$ clang++ --cuda-path=/opt/cuda-8.0 -lcudart -I/opt/cuda-8.0/include -O3 streamcluster_cuda_cpu.cpp streamcluster_cuda.cu streamcluster_header.cu -o sc_gpu
In file included from streamcluster_cuda_cpu.cpp:16:
In file included from ./streamcluster_header.cu:20:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/iostream:39:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ostream:38:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ios:42:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/ios_base.h:41:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/locale_classes.h:40:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/string:41:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/allocator.h:46:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8/bits/c++allocator.h:33:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ext/new_allocator.h:33:
/opt/llvm-5.0/lib/clang/5.0.0/include/cuda_wrappers/new:37:1: error: unknown type name '__device__'
__device__ inline void *operator new(__SIZE_TYPE__, void *__ptr) CUDA_NOEXCEPT {
^
/opt/llvm-5.0/lib/clang/5.0.0/include/cuda_wrappers/new:37:12: error: expected unqualified-id
__device__ inline void *operator new(__SIZE_TYPE__, void *__ptr) CUDA_NOEXCEPT {
^
/opt/llvm-5.0/lib/clang/5.0.0/include/cuda_wrappers/new:40:1: error: unknown type name '__device__'
__device__ inline void *operator new[](__SIZE_TYPE__, void *__ptr) CUDA_NOEXCEPT {
^
/opt/llvm-5.0/lib/clang/5.0.0/include/cuda_wrappers/new:40:12: error: expected unqualified-id
__device__ inline void *operator new[](__SIZE_TYPE__, void *__ptr) CUDA_NOEXCEPT {
^
/opt/llvm-5.0/lib/clang/5.0.0/include/cuda_wrappers/new:43:1: error: unknown type name '__device__'
__device__ inline void operator delete(void *, void *) CUDA_NOEXCEPT {}
^
/opt/llvm-5.0/lib/clang/5.0.0/include/cuda_wrappers/new:43:12: error: expected unqualified-id
__device__ inline void operator delete(void *, void *) CUDA_NOEXCEPT {}
^
/opt/llvm-5.0/lib/clang/5.0.0/include/cuda_wrappers/new:44:1: error: unknown type name '__device__'
__device__ inline void operator delete[](void *, void *) CUDA_NOEXCEPT {}
^
/opt/llvm-5.0/lib/clang/5.0.0/include/cuda_wrappers/new:44:12: error: expected unqualified-id
__device__ inline void operator delete[](void *, void *) CUDA_NOEXCEPT {}
^
streamcluster_cuda_cpu.cpp:745:27: warning: format specifies type 'unsigned int' but the argument has type 'long' [-Wformat]
fprintf(fp, "%u\n", centerIDs[i]);
~~ ^~~~~~~~~~~~
%ld
streamcluster_cuda_cpu.cpp:793:39: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
fprintf(stderr,"read %d points\n",numRead);
~~ ^~~~~~~
%lu
streamcluster_cuda_cpu.cpp:795:63: warning: '&&' within '||' [-Wlogical-op-parentheses]
if( stream->ferror() || numRead < (unsigned int)chunksize && !stream->feof() ) {
~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
streamcluster_cuda_cpu.cpp:795:63: note: place parentheses around the '&&' expression to silence this warning
if( stream->ferror() || numRead < (unsigned int)chunksize && !stream->feof() ) {
^
( )
3 warnings and 8 errors generated.
More information about the cfe-dev
mailing list