[mvapich-discuss] Error compiling with CUDA code with

sreeram potluri potluri.2 at osu.edu
Thu Jan 2 09:46:31 EST 2014


Hi Amirul,

I tried your test program locally and I do not see any issues with my
MVPAICH2 2.0b installation. I am using the similar configuration options as
the ones you have used.

Can you check your installation of MVAPICH2 (redo it if the cuda libraries
have been updated or if the library was build on a node with different
version of the libraries)? This is my hunch given that you were able use
the CUDA installation itself without any issues.

[potluri at sandy5 mvapich2-2.0b]$ ./install/bin/mpiname -a
MVAPICH2 2.0b Fri Nov  8 11:17:40 EST 2013 ch3:mrail

Compilation
CC: gcc    -g
CXX: g++   -g
F77: no -L/lib -L/lib   -g
FC: no   -g

Configuration
--enable-g=dbg --enable-fast=none --enable-cuda
--with-cuda-include=/usr/local/cuda/include
--with-cuda-libpath=/usr/local/cuda/lib64 --disable-fc --disable-f77
--prefix=/home/potluri/MPI/IB/DEVELOPMENT/MVAPICH2-GPU/STANDARD/mvapich2-2.0b/install

[potluri at sandy5 mvapich2-2.0b]$ cat ex.c
#include <mpi.h>
#include <cuda_runtime_api.h>
#include <stdio.h>

int main(int argc, char **argv) {
  int myrank;
  MPI_Init(&argc, &argv);
  MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
  printf("check rank :%i\n",myrank);
  int *d_temp;

  cudaMalloc((void**)&d_temp,sizeof(int)*10);

 if (myrank == 0) {
   printf("1 \n");
  } else {
   printf("1 \n");
  }
  cudaFree (d_temp);
  MPI_Finalize();
  return 0;
}


[potluri at sandy5 mvapich2-2.0b]$ ./install/bin/mpicc -o ex ex.c


[potluri at sandy5 mvapich2-2.0b]$ ./ex
check rank :0
1

Sreeram Potluri


On Wed, Jan 1, 2014 at 8:53 PM, Mohamad Amirul Abdullah <
amirul.abdullah at mimos.my> wrote:

>  Hi,
>
> Im having problem to compile CUDA code with mpicc that was installed
> together with MVAPICH2.20b. It seems that some of the the compiler unable
> to read some symbol in libcudart. Im able to compile with nvcc seperately
> without error (without MPI code inside). I have try few method to compile
> this but it still prompt out same error. How to debug this problem? The
> sample code and sample makefile is show below.
>
> * Error*
> mpicc -I/usr/local/cuda/include -L/usr/local/cuda/lib64 -lcudart  mpiTest.c
> /usr/bin/ld: /tmp/ccsxy5CZ.o: undefined reference to symbol 'cudaMalloc'
> /usr/bin/ld: note: 'cudaMalloc' is defined in DSO
> /usr/local/cuda/lib64/libcudart.so so try adding it to the linker command
> line
> */usr/local/cuda/lib64/libcudart.so: could not read symbols: Invalid
> operation*
> collect2: ld returned 1 exit status
> make: *** [mpi] Error 1
>
> *Makefile*
> MPI=mpicc
> NVCCINCLUDE=-I/usr/local/cuda/include
> NVCCLIB=-L/usr/local/cuda/lib64 -lcudart
>
> all: mpi
>
> <https://owa.mimos.my/owa/?ae=Item&a=New&t=IPM.Note&cc=MTQuMS40MzguMCxlbi1VUyw1LEhUTUwsMCww&pspid=_1388624998532_18076859#>
> mpi:
>     $(MPI) $(NVCCINCLUDE) $(NVCCLIB) mpiTest.c
> clean:
>     rm -rf *o hello
>
>
> *MVAPICH setting*
> root at gpu0: mpiname -a
> MVAPICH2 2.0b Fri Nov  8 11:17:40 EST 2013 ch3:mrail
>
> Compilation
> CC: gcc    -g
> CXX: g++   -g
> F77: no -L/lib -L/lib   -g
> FC: no   -g
>
> Configuration
> --disable-fast --enable-g=dbg --enable-cuda
> --with-cuda-include=/usr/local/cuda/include
> --with-cuda-libpath=/usr/local/cuda/lib64 --disable-fc --disable-f77
>
> *Code*
> #include <mpi.h>
> #include <cuda_runtime_api.h>
>
> int main(int argc, char **argv){
>   int myrank;
>   MPI_Init(&argc, &argv);
>   MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
>   printf("check rank :%i\n",myrank);
>   int *d_temp;
>
>   cudaMalloc((void**)&d_temp,sizeof(int)*10);
>
>  if (myrank == 0) {
>    printf("1\n");
>   } else {
>    printf("1\n");
>   }
>   cudaFree (d_temp);
>   MPI_Finalize();
>   return 0;
> }
>
> Regards,
> -Amirul-
>
>
> _______________________________________________
> mvapich-discuss mailing list
> mvapich-discuss at cse.ohio-state.edu
> http://mailman.cse.ohio-state.edu/mailman/listinfo/mvapich-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cse.ohio-state.edu/pipermail/mvapich-discuss/attachments/20140102/c9afbd16/attachment.html>


More information about the mvapich-discuss mailing list