Re: [cfe-users] How to tell Clang which version of CUDA to use ?

2017-08-29 Thread Jean-Loup Tastet via cfe-users
As a workaround, we have temporarily disabled the CUDA 9.0 install (by
renaming its directory to /usr/local/_cuda-9.0). Now the program
compiles as expected (I also recompiled Clang in the meantime).

As soon as I manage to convince my sysadmin to enable CUDA 9.0 again, I
will retry with the `-v` command-line option and post the output here.

On Mon, 2017-08-28 at 11:42 -0700, Justin Lebar wrote:
> --cuda-path is the right flag to pass.  Strange it's not doing the
> right thing for you.
> 
> Can you include the output of running the same command line with -v?
> 
> On Fri, Aug 18, 2017 at 3:55 AM, Jean-Loup Tastet via cfe-users
>  wrote:
> > Hi,
> > 
> > I am trying to use Clang to compile CUDA device code. I followed
> > the
> > instructions in [1] and compiled the latest Clang trunk [2].
> > 
> > However, my system has both CUDA 8.0 and 9.0 RC installed, in
> > `/usr/local/cuda-{8.0,9.0}`. The default `/usr/local/cuda` is
> > symlinked
> > to `/usr/local/cuda-8.0`.
> > 
> > Clang only supports version 8.0, however it seems to incorrectly
> > pick
> > version 9.0, even when manually specifying the `--cuda-path`. For
> > instance, trying to compile a trivial CUDA program (with no
> > kernel):
> > ```
> > $ cat main.cu
> > #include 
> > #include 
> > 
> > int main(int argc, char* argv[])
> > {
> > std::cout << "Hello, World!" << std::endl;
> > }
> > 
> > $ clang++ -o main main.cu \
> > --cuda-path=/usr/local/cuda-8.0 \
> > -I/usr/local/cuda-8.0/include \
> > -L/usr/local/cuda-8.0/lib64 \
> > -lcudart_static -ldl -lrt -pthread
> > ```
> > generates the following error:
> > ```
> > /home/jtastet/.local/stow/llvm_gcc-
> > 6.3/lib/clang/6.0.0/include/__clang_cuda_runtime_wrapper.h:66:2:
> > error:
> > "Unsupported CUDA version!"
> > #error "Unsupported CUDA version!"
> >  ^
> > In file included from :1:
> > In file included from /home/jtastet/.local/stow/llvm_gcc-
> > 6.3/lib/clang/6.0.0/include/__clang_cuda_runtime_wrapper.h:169:
> > /usr/local/cuda-9.0/targets/x86_64-
> > linux/include/device_functions.hpp:218:10: error: reference to
> > __device__ function '__nvvm_bar0_popc' in __host__ function
> >   return __nvvm_bar0_popc(predicate);
> >  ^
> > /usr/local/cuda-9.0/targets/x86_64-
> > linux/include/device_functions.hpp:218:10: note: '__nvvm_bar0_popc'
> > declared here
> > /usr/local/cuda-9.0/targets/x86_64-
> > linux/include/device_functions.hpp:223:10: error: reference to
> > __device__ function '__nvvm_bar0_and' in __host__ function
> >   return __nvvm_bar0_and(predicate);
> >  ^
> > [...output truncated...]
> > ```
> > Note the reference to CUDA 9.0 in the path.
> > 
> > Do you know how to tell Clang which version of CUDA to use ? Does
> > it
> > have to be specified at compile-time or as a command-line option ?
> > 
> > Uninstalling CUDA 9.0 is not an option here, since I do not have
> > privileged access to the machine.
> > 
> > Thanks in advance for your help !
> > 
> > Best regards,
> > Jean-Loup Tastet
> > 
> > 
> > [1] https://llvm.org/docs/CompileCudaWithLLVM.html
> > [2] For reference, I compiled revision 311091 with the following
> > configuration:
> > ```
> > cmake -G "Unix Makefiles" \
> > -D CMAKE_INSTALL_PREFIX=/home/jtastet/.local/stow/llvm_gcc-6.3
> > \
> > -D CMAKE_BUILD_TYPE=Release \
> > -D
> > GCC_INSTALL_PREFIX=/afs/cern.ch/sw/lcg/external/gcc/6.3/x86_64-
> > centos7 \
> > ..
> > ```
> > ___
> > cfe-users mailing list
> > cfe-users@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


[cfe-users] Bitcode embedded fat iOS static library from c++ code

2017-08-29 Thread Tamas Toth via cfe-users

Hi,

I would like to create a fat iOS static library from a bunch of c++ code 
(multiple projects) with embedded bitcode. I would like to use this 
library in an Xcode workspace where bitcode is enabled. The server where 
the c++ code is being built is CentOS based. So I downloaded LLVM 4.0 
with clang. With the help of clang and other tools I'm able to compile 
the code into libraries supporting armv7 and arm64 architectures and 
create a single fat library (using libtool and lipo). Everything works 
fine until I would like to achieve a bitcode embedded library. I thought 
that the only thing I need to do is to add the -fembed-bitcode option to 
clang. But when I try to export on Mac OS X the archived workspace for 
ad-hoc distribution, I got a strange error message:


error: Failed to verify bitcode in ***.app/***:

error: Clang option verification failed for bitcode 506 (unrecognized 
arguments: -mrelax-all -fembed-bitcode=all -disable-free 
-disable-llvm-verifier -discard-value-names -main-file-name 
algorithm.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix 
-mdisable-fp-elim -masm-verbose -target-cpu cortex-a8 -target-feature 
+soft-float-abi -target-linker-version 134.9 -dwarf-column-info 
-debugger-tuning=lldb -coverage-file ***/algorithm.opp -resource-dir 
/opt/llvm-4.0.0/bin/../lib64/clang/4.0.0 -std=gnu++11 
-fdebug-compilation-dir *** -ferror-limit 19 -fmessage-length 192 
-stack-protector 1 -fallow-half-arguments-and-returns -fblocks 
-fobjc-runtime=ios-8.0.0 -fencode-extended-block-signature 
-fsjlj-exceptions -fmax-type-align=16 -fdiagnostics-show-option 
-fcolor-diagnostics)


Can anybody help what can be the error? Or my thoughts about how to 
build a bitcode embedded static library are wrong? Any help is really 
appreciated!

___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users