Problem building LAMMPS with Intel icps

I have not built LAMMPS in a while but now I am trying to build the latest version lammps-23Jun2022. I was able to build the gpu library, that worked well, but with lammps itself I am having trouble.

I am using the Intel compiler and run into this error:

mpicxx -g -O3 -std=c++11 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -DLMP_GPU -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -DFFT_FFTW -I/nasa/intel/Compiler/2020.4.304/compilers_and_libraries_2020.4.304/linux/mkl/include/fftw -c …/fix_nh_gpu.cpp
…/fix_nh_gpu.cpp(80): error: cannot deduce “auto” type (initializer required)
auto * _noalias const x = (dbl3_t *) atom->x[0];

Has anybody else experience building with icpc?

This is most certainly a bug of the intel compiler. Have you tried a more recent version?

This could be worked around with this change:

  diff --git a/src/GPU/fix_nh_gpu.cpp b/src/GPU/fix_nh_gpu.cpp
  index e90be98d6b..53999fe52c 100644
  --- a/src/GPU/fix_nh_gpu.cpp
  +++ b/src/GPU/fix_nh_gpu.cpp
  @@ -77,7 +77,7 @@ void FixNHGPU::remap()
     double oldlo,oldhi;
     double expfac;
   
  -  auto * _noalias const x = (dbl3_t *) atom->x[0];
  +  dbl3_t * _noalias const x = (dbl3_t *) atom->x[0];
     int *mask = atom->mask;
     int nlocal = atom->nlocal;
     double *h = domain->h;
  @@ -414,7 +414,7 @@ void FixNHGPU::nh_v_press()
       return;
     }
   
  -  auto * _noalias const v = (dbl3_t *)atom->v[0];
  +  dbl3_t * _noalias const v = (dbl3_t *)atom->v[0];
     int *mask = atom->mask;
     int nlocal = atom->nlocal;
     if (igroup == atom->firstgroup) nlocal = atom->nfirst;

Thanks so much, Axel, for the quick reply, I did try with the latest version which I can find at my site, but same old same old:picxx -g -O3 -mkl -std=c++11 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -DLMP_GPU -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -DFFT_FFTW -I/nasa/intel/Compiler/2021.3.0/mkl/2021.3.0/include/fftw -c …/fix_nh_gpu.cpp
…/fix_nh_gpu.cpp(80): error: cannot deduce “auto” type (initializer required)
auto * _noalias const x = (dbl3_t *) atom->x[0];

With g++ I can compile just fine, but then I am having problems using the Intel MKL for fftw. I will try to apply your work around and I will also try to find a way to use the MKL with g++.
Many thanks again.
^

LAMMPS supports the MKL provided FFTs directly, no need to go through the FFTW wrappers.
Besides, optimizing the FFTs rarely has a measurable impact on overall performance.
You can gain maybe 20-30% with a tuned FFT and versus the KISS FFT and even less versus the regular FFTW for the time spent on the FFT. But that is only part of KSpace (when using PPPM, that is) and unless you are running with a number of MPI ranks where the 3dFFTs become performance limiting, KSpace will consume about 30% or less of the total time.

At that point, it is probably more important to look at using MPI+OpenMP or verlet/split or compiling with single precision FFTs in order to improve performance.

Hi Axel,
It looks like the code change you suggested is already present in the lammps source code that I have:void FixNHGPU::remap()
{
if (_respa_on) { FixNH::remap(); return; }

double oldlo,oldhi;
double expfac;

auto * _noalias const x = (dbl3_t *) atom->x[0];
int *mask = atom->mask;
int nlocal = atom->nlocal;
double *h = domain->h;

// omega is not used, except for book-keeping

No, please see the deleted lines (starting with a -) and compare to the added lines (starting with a +). Key is to replace the auto type with the actual type.

Thanks, Axel. I had tried, but then I got more errors, don’t have them handy, but they were of the type "expecting a ; ".
I went back to try build with gcc, but the lammps gpu does not compile with any compiler more recent that 4.8. I don’t want to build with that one, for other reasons.
This is what I get for
gcc9.2:nvc++ -std=c++11 -DMPI_GERYON -DUCL_NO_EXIT -DMPICH_IGNORE_CXX_SEEK -DOMPI_SKIP_MPICXX=1 -fPIC -lmpi -O2 -DLAMMPS_SMALLBIG -D_SINGLE_DOUBLE -I/nasa/cuda/11.0/include -I./cudpp_mini -DUSE_CUDPP -Icudpp_mini -o lal_buck_coul_long_ext.o -c lal_buck_coul_long_ext.cpp -I./
“/nasa/pkgsrc/toss3/2021Q2/gcc9/include/c++/bits/stringfwd.h”, line 72: error: expected a “;”
template<typename _CharT, typename _Traits = char_traits<_CharT>,

Have you been able to build the library with gcc/nvcc ? Maybe something is not set up correctly on our system. Would you recommend trying a somewhat older version of lammps?

Axel, I need to correct myself, the libgpu does build with gcc9.2, if I use g++ instead of nvc++ as C++ compiler!