cancel
Showing results for 
Search instead for 
Did you mean: 

Server Processors

vvk
Journeyman III

Issues compiling LAMMPS with -march=native

I'm trying to compile LAMMPS ( https://lammps.sandia.gov/ ) on the master node of an EPYC 7282, so that it may later run on nodes that are EPYC 7542. The CXX flags I'm trying to use are: "-O3 -march=native". But doing so gives me the attached error when I `make`. Note that I am able to build the software when I only use "-O3".

Am I doing anything wrong?

0 Likes
3 Replies

Dear vvk‌,

I assume you are using gnu compiler for your compilation. I am able to compiler lammps-19Mar20 version successfully with -march=native.

My system details are

CPU Model    : AMD EPYC 7601

OS                : Cent OS 8

GNU              : 9.2.0

openMPI       : 4.0.3

ldd                : 2.28

Step that I folled for my compilation :

    $ cd lammps-19Mar20/src/

    $ make yes-asphere yes-class2 yes-kspace yes-manybody yes-misc yes-molecule
    $ make yes-mpiio yes-opt yes-replica yes-rigid
    $ make yes-user-omp

    Then

    $ make g++_openmpi 

I have added -march=native to my Makefile.g++_openmpi in MAKE/OPTIONS makefile as you faced compilation issues.

Make snippet :

mpicxx -g -O3 -march=native   -DLAMMPS_GZIP -DLMP_USER_OMP -DLMP_MPIIO  -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1    -c ../pair_eam_fs.cpp
mpicxx -g -O3 -march=native   -DLAMMPS_GZIP -DLMP_USER_OMP -DLMP_MPIIO  -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1    -c ../fix_press_berendsen.cpp
mpicxx -g -O3 -march=native   -DLAMMPS_GZIP -DLMP_USER_OMP -DLMP_MPIIO  -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1    -c ../fix_rigid_nh_small.cpp
mpicxx -g -O3  -march=native    <obj_files>       -o ../lmp_g++_openmpi

size ../lmp_g++_openmpi
   text    data     bss     dec     hex filename
11856908           8632   16224 11881764         b54d24 ../lmp_g++_openmpi

Please share your compilation steps that you used for lammps including version detail etc for better undestanding of your compilation error.

Thanks

Ravi

0 Likes

Hi Ravi,  I'm sorry I did not mention this when describing the problem, but I'm using AOCC v2.2.0 + Clang v10.0.0 .

I'm using the latest stable LAMMPS: 29 Oct 2020. The cmake command I run before I run make is as follows:

cmake ../cmake \
   -DCMAKE_CXX_COMPILER=clang++ \
   -DCMAKE_CXX_FLAGS="-O3 -march=native" \
   -DMPI_C_COMPILER=mpicc \
   -DMPI_CXX_COMPILER=mpicxx

0 Likes

Dear vvk

Thank you for the clarification.

I didnt find any issue with your cmake. Even I am able to buildsuccessfully with your cmake command.

cmake ../cmake/  \

-DCMAKE_CXX_COMPILER=clang++    -DCMAKE_CXX_FLAGS="-O3 -march=native"    \

-DMPI_C_COMPILER=mpicc    -DMPI_CXX_COMPILER=mpicxx \

-DCMAKE_INSTALL_PREFIX=/home/rkuppili/benchmark/lammps/lammps-29Oct20/ravi

Could you please share your CMakeOutput.log file for further investigation?

In the meantime, could you please try with normal make procedure?

Steps:

1.     cd  to lammps-29Oct20/src, then
        make yes-asphere yes-class2 yes-kspace yes-manybody yes-misc yes-molecule
        make yes-mpiio yes-opt yes-replica yes-rigid
        make yes-user-omp

2. In src folder, Please run below commands

         cp MAKE/OPTIONS/Makefile.g++_openmpi MAKE/OPTIONS/Makefile.clang++_openmpi
        sed -i 's/OMPI_CXX = g++/OMPI_CXX = clang++/'  MAKE/OPTIONS/Makefile.clang++_openmpi
        sed -i 's/g++_openmpi/clang++_openmpi/'  MAKE/OPTIONS/Makefile.clang++_openmpi
        sed -i 's/GNU g++/AOCC clang++/'  MAKE/OPTIONS/Makefile.clang++_openmpi
        sed -i "s|-g -O3| -O3 -march=native |" MAKE/OPTIONS/Makefile.clang++_openmpi
        sed -i  's/ARCHIVE =\sar/ARCHIVE =       llvm-ar/' MAKE/OPTIONS/Makefile.clang++_openmpi

3. Then

    make -j 32 clang++_openmpi

Please let me know if you find any issues with this make procedure.

Thanks

Ravi

0 Likes