LAMMPS 27 Aug + USER-CUDA make errors

Hello,

I’m trying to build the latest LAMMPS 27 Aug code with USER-CUDA package and experience some errors during the build. I generally solved them for my machine but don’t know how universal this solution is. My config is Suse Linux Enterprise 11 SP1 + Intel Compilers + MPICH2 + Tesla M2050.

So, I built the library liblammpscuda.a with default settings in lammps/lib/cuda, set “make yes-USER-CUDA”, modified lammps/src/MAKE/Makefile.linux with paths to MPICH2 and launch “make linux”.

Typical errors during the make process are undefined identifiers and references like

cuda.cpp(74): error: identifier “CUDA_ARCH” is undefined
if(shared_data.compile_settings.arch!=CUDA_ARCH) printf("\n\n # CUDA WARNING: Compile Settings of cuda and cpp code differ! \n # CUDA WARNING: arch: cuda %i cpp %i\n\n",shared_data.compile_settings.cufft, CUDA_ARCH);

…/…/lib/cuda/liblammpscuda.a(atom_vec_cuda_cu.o): In function global constructors keyed to _Z26AtomVecCuda _CountDataItemsj': tmpxft_00000ca0_00000000-1_atom_vec_cuda.cudafe1.cpp:(.text+0xfe): undefined reference to cudaCreateChannelD
esc’

Researching the cause, I found the misprint in the file ./lib/cuda/Makefile.lammps. Instead of “CUDA_INSATLL_PATH = /usr/local/cuda” there should be “CUDA_INSTALL_PATH = /usr/local/cuda”. That misprint causes a lot of make errors.

Next, as stated here (http://lammps.sandia.gov/threads/msg22446.html) lammps/lib/cuda/Makefile.common should be included in lammps/src/Makefile.package but actually it is not, so I added to lammps/src/Makefile.package the lines

include /opt/lammps-27Aug11/lib/cuda/Makefile.lammps
include /opt/lammps-27Aug11/lib/cuda/Makefile.common

After that I was able to build LAMMPS with USER-CUDA.

Next possible error (it disappeared when I fixed the other ones so I’m not sure that it is the error) is that in ./src/USER-CUDA/fft3d_cuda.h line 92 you should add the else condition

#else

typedef struct {

float re;

float im;

} FFT_DATA;

#endif

Otherwise, there will be errors like “identifier “FFT_DATA” is undefined” in the case you don’t use Cuda FFT realization (-DFFT_CUFFT).

Don’t forget to reinstall the USER-CUDA package after changing the source:

make no-USER-CUDA

make yes-USER-CUDA

Hope this will help to someone to build LAMMPS with USER-CUDA package.

Nikita Tropin | Scientist

Comments below. I think Christian needs to chime in on some of this.

Steve

Hello,

I'm trying to build the latest LAMMPS 27 Aug code with USER-CUDA package and
experience some errors during the build. I generally solved them for my
machine but don't know how universal this solution is. My config is Suse
Linux Enterprise 11 SP1 + Intel Compilers + MPICH2 + Tesla M2050.

So, I built the library liblammpscuda.a with default settings in
lammps/lib/cuda, set "make yes-USER-CUDA", modified
lammps/src/MAKE/Makefile.linux with paths to MPICH2 and launch "make linux".

Typical errors during the make process are undefined identifiers and
references like

cuda.cpp(74): error: identifier "CUDA_ARCH" is undefined
if(shared_data.compile_settings.arch!=CUDA_ARCH) printf("\n\n # CUDA
WARNING: Compile Settings of cuda and cpp code differ! \n # CUDA WARNING:
arch: cuda %i cpp %i\n\n",shared_data.compile_settings.cufft, CUDA_ARCH);

../../lib/cuda/liblammpscuda.a(atom_vec_cuda_cu.o): In function `global
constructors keyed to _Z26AtomVecCuda
_CountDataItemsj':
tmpxft_00000ca0_00000000-1_atom_vec_cuda.cudafe1.cpp:(.text+0xfe): undefined
reference to `cudaCreateChannelD
esc'
Researching the cause, I found the misprint in the file
./lib/cuda/Makefile.lammps. Instead of "CUDA_INSATLL_PATH = /usr/local/cuda"
there should be "CUDA_INSTALL_PATH = /usr/local/cuda". That misprint causes
a lot of make errors.

I fixed this typo. It will be part of a patch later today.

Next, as stated here (http://lammps.sandia.gov/threads/msg22446.html)
lammps/lib/cuda/Makefile.common should be included in
lammps/src/Makefile.package but actually it is not, so I added to
lammps/src/Makefile.package the lines

include /opt/lammps-27Aug11/lib/cuda/Makefile.lammps
include /opt/lammps-27Aug11/lib/cuda/Makefile.common

Makefile.common should not be necessary. Only what is in
lib/cuda/Makefile.lammps. If there is something missing
in the latter file, then we need to add it. Christian?

After that I was able to build LAMMPS with USER-CUDA.
Next possible error (it disappeared when I fixed the other ones so I'm not
sure that it is the error) is that in ./src/USER-CUDA/fft3d_cuda.h line 92
you should add the else condition

#else

typedef

struct {

float re;

float im;

}

FFT_DATA;

#endif

Otherwise, there will be errors like "identifier "FFT_DATA" is undefined" in
the case you don't use Cuda FFT realization (-DFFT_CUFFT).

I'll let Chrisitian comment on the FFT issues ...

steve,

[...]

#else

typedef

struct {

float re;

float im;

}

FFT_DATA;

#endif

Otherwise, there will be errors like "identifier "FFT_DATA" is undefined" in
the case you don't use Cuda FFT realization (-DFFT_CUFFT).

I'll let Chrisitian comment on the FFT issues ...

this is likely due to our recent FFT changes since FFT_NONE
now implies FFT_KISSFFT and thus there will always be an
FFT library compiled in.

i can have a look at it as well (since i am mostly responsible for this),
if desired. i just can't do it right away due to working on getting the
OpenMP stuff pushed through.

cheers,
    axel.

If I don't include lammps/lib/cuda/Makefile.common in lammps/src/Makefile.package I have the error during make

cuda.cpp(74): error: identifier "CUDA_ARCH" is undefined
      if(shared_data.compile_settings.arch!=CUDA_ARCH) printf("\n\n # CUDA WARNING: Compile Settings of cuda and cpp code differ! \n # CUDA WARNING: arch: cuda %i cpp %i\n\n",shared_data.compile_settings.cufft, CUDA_ARCH);

So, lammps/lib/cuda/Makefile.common provides at least the following needed options:

-DUNIX -DCUDA_PRECISION=1 -DCUDA_ARCH=20

Nikita Tropin | Scientist

Hi

I didnt check the latest version out yet, but I will test the changes that were made to the Make system and try to fix them.

Christian

-------- Original-Nachricht --------