2 Replies Latest reply on Feb 13, 2015 7:48 AM by kalyanpk

    CUDA Breaks CodeXL 1.6 in Linux

    omnidirectional

      It took us several days to solve this problem, and I hope that this post will help others avoid our frustration.

       

      We are porting from CUDA to OpenCL on an AMD 7850 APU.  Our Ubuntu 14.04 system is a hybrid with both CUDA & AMD's OpenCL installed.  We can run our code using either CUDA or OpenCL.  Unfortunately CodeXL doesn't seem to work on code that includes CUDA even if the CUDA instructions are not executed.

       

      We tested this theory by starting with code that CodeXL could work with.  We then took this code and linked with the CUDA runtime library (libcudart.so) and added one trivial call to CUDA:

       

           #include<cuda_runtime.h>

           int x;

           cudaGetDevicecount(&x);

       

      The OpenCL program still compiles & runs with this small bit of new code, but CodeXL gives several unrelated errors and stops profiling.  Ideally CodeXL would ignore CUDA instructions, but it seems like CodeXL doesn't believe in peaceful coexistence.

       

      Our conclusion is that CodeXL will bail if the program that it is profiling links to a CUDA library.  We corrected this problem by putting #ifdefs around the CUDA code.  It would be nice if CodeXL 1.7 can tolerate CUDA/OpenCL hybrid programs.  This would simplify the porting of our CUDA code.