Compile gromacs with nvhpc 23.5 on arm64

I am trying to build gromacs 22.4 with nvhpc 23.5 on arm64 and run into the following error (related to int64_t). Is there any walk around this?

cd /shared/tools/gromacs-2022.4/build_mpi-nvhpc/src/gromacs && /shared/nvidia/hpc_sdk/Linux_aarch64/23.5/comm_libs/mpi/bin/mpicxx -DGMX_DOUBLE=0 -DHAVE_CONFIG_H -DMUPARSER_STATIC -DTMPI_EXPORTS -DTMPI_USE_VISIBILITY -DUSE_STD_INTTYPES_H -I/shared/tools/gromacs-2022.4/src/include -I/shared/tools/gromacs-2022.4/build_mpi-nvhpc/src/include -I/shared/tools/gromacs-2022.4/src -I/shared/tools/gromacs-2022.4/api/legacy/include -I/shared/tools/gromacs-2022.4/build_mpi-nvhpc/api/legacy/include -I/shared/tools/gromacs-2022.4/src/gromacs/analysisdata/include -I/shared/tools/gromacs-2022.4/src/gromacs/utility/include -I/shared/tools/gromacs-2022.4/src/gromacs/applied_forces/include -I/shared/tools/gromacs-2022.4/src/gromacs/commandline/include -I/shared/tools/gromacs-2022.4/src/gromacs/compat/include -I/shared/tools/gromacs-2022.4/src/gromacs/coordinateio/include -I/shared/tools/gromacs-2022.4/src/gromacs/correlationfunctions/include -I/shared/tools/gromacs-2022.4/src/gromacs/domdec/include -I/shared/tools/gromacs-2022.4/src/gromacs/essentialdynamics/include -I/shared/tools/gromacs-2022.4/src/gromacs/ewald/include -I/shared/tools/gromacs-2022.4/src/gromacs/fft/include -I/shared/tools/gromacs-2022.4/src/gromacs/fileio/include -I/shared/tools/gromacs-2022.4/src/gromacs/gmxana/include -I/shared/tools/gromacs-2022.4/src/gromacs/gmxlib/include -I/shared/tools/gromacs-2022.4/src/gromacs/gmxpreprocess/include -I/shared/tools/gromacs-2022.4/src/gromacs/gpu_utils/include -I/shared/tools/gromacs-2022.4/src/gromacs/hardware/include -I/shared/tools/gromacs-2022.4/src/gromacs/imd/include -I/shared/tools/gromacs-2022.4/src/gromacs/linearalgebra/include -I/shared/tools/gromacs-2022.4/src/gromacs/listed_forces/include -I/shared/tools/gromacs-2022.4/src/gromacs/math/include -I/shared/tools/gromacs-2022.4/src/gromacs/mdlib/include -I/shared/tools/gromacs-2022.4/src/gromacs/mdrun/include -I/shared/tools/gromacs-2022.4/src/gromacs/mdrunutility/include -I/shared/tools/gromacs-2022.4/src/gromacs/mdspan/include -I/shared/tools/gromacs-2022.4/src/gromacs/mdtypes/include -I/shared/tools/gromacs-2022.4/src/gromacs/mimic/include -I/shared/tools/gromacs-2022.4/src/gromacs/modularsimulator/include -I/shared/tools/gromacs-2022.4/src/gromacs/nbnxm/include -I/shared/tools/gromacs-2022.4/src/gromacs/onlinehelp/include -I/shared/tools/gromacs-2022.4/src/gromacs/options/include -I/shared/tools/gromacs-2022.4/src/gromacs/pbcutil/include -I/shared/tools/gromacs-2022.4/src/gromacs/pulling/include -I/shared/tools/gromacs-2022.4/src/gromacs/random/include -I/shared/tools/gromacs-2022.4/src/gromacs/restraint/include -I/shared/tools/gromacs-2022.4/src/gromacs/selection/include -I/shared/tools/gromacs-2022.4/src/gromacs/simd/include -I/shared/tools/gromacs-2022.4/src/gromacs/statistics/include -I/shared/tools/gromacs-2022.4/src/gromacs/swap/include -I/shared/tools/gromacs-2022.4/src/gromacs/tables/include -I/shared/tools/gromacs-2022.4/src/gromacs/taskassignment/include -I/shared/tools/gromacs-2022.4/src/gromacs/timing/include -I/shared/tools/gromacs-2022.4/src/gromacs/tools/include -I/shared/tools/gromacs-2022.4/src/gromacs/topology/include -I/shared/tools/gromacs-2022.4/src/gromacs/trajectory/include -I/shared/tools/gromacs-2022.4/src/gromacs/trajectoryanalysis/include -isystem /shared/tools/gromacs-2022.4/src/external/thread_mpi/include -isystem /shared/tools/gromacs-2022.4/src/external -isystem /shared/fftw-3.3.9/include -isystem /shared/tools/gromacs-2022.4/src/external/tng_io/include -isystem /shared/tools/gromacs-2022.4/build_mpi-nvhpc/tng/include -isystem /shared/tools/gromacs-2022.4/src/external/lmfit -isystem /shared/tools/gromacs-2022.4/src/external/muparser/include -std=c++17 -tp=neoverse-v1 -g -fast -O3 -DNDEBUG --c++17 -msve-vector-bits=256 -mp -MD -MT src/gromacs/CMakeFiles/libgromacs.dir/fileio/checkpoint.cpp.o -MF CMakeFiles/libgromacs.dir/fileio/checkpoint.cpp.o.d -o CMakeFiles/libgromacs.dir/fileio/checkpoint.cpp.o -c /shared/tools/gromacs-2022.4/src/gromacs/fileio/checkpoint.cpp

error messages:

"/shared/tools/gromacs-2022.4/api/legacy/include/gromacs/math/functions.h", line 118: error: expected an identifier
  unsigned int log2I(std::int64_t x);
                          ^

"/shared/tools/gromacs-2022.4/api/legacy/include/gromacs/math/functions.h", line 118: error: declaration is incompatible with "unsigned int gmx::log2I(int32_t)" (declared at line 107)
  unsigned int log2I(std::int64_t x);
               ^

"/shared/tools/gromacs-2022.4/api/legacy/include/gromacs/math/functions.h", line 118: error: expected a ")"
  unsigned int log2I(std::int64_t x);
                          ^

"/shared/tools/gromacs-2022.4/api/legacy/include/gromacs/math/functions.h", line 129: error: declaration is incompatible with "unsigned int gmx::log2I" (declared at line 118)
  unsigned int log2I(std::uint32_t x);
               ^

"/shared/tools/gromacs-2022.4/api/legacy/include/gromacs/math/functions.h", line 140: error: declaration is incompatible with previous "gmx::log2I" (declared at line 118)
  unsigned int log2I(std::uint64_t x);
               ^

"/shared/tools/gromacs-2022.4/api/legacy/include/gromacs/math/functions.h", line 149: error: expected an identifier
  std::int64_t greatestCommonDivisor(std::int64_t p, std::int64_t q);
       ^

"/shared/tools/gromacs-2022.4/api/legacy/include/gromacs/math/functions.h", line 149: error: expected a ";"
  std::int64_t greatestCommonDivisor(std::int64_t p, std::int64_t q);
       ^

"/shared/tools/gromacs-2022.4/src/gromacs/trajectory/trajectoryframe.h", line 123: error: expected an identifier
      std::int64_t step() const;
           ^

"/shared/tools/gromacs-2022.4/src/gromacs/trajectory/trajectoryframe.h", line 123: error: this declaration has no storage class or type specifier
      std::int64_t step() const;
      ^

"/shared/tools/gromacs-2022.4/src/gromacs/trajectory/trajectoryframe.h", line 123: error: expected a ";"
      std::int64_t step() const;
           ^

"/shared/tools/gromacs-2022.4/src/gromacs/utility/mdmodulesnotifiers.h", line 110: error: expected an identifier
      std::int64_t energyCalculationIntervalInSteps() const
           ^

"/shared/tools/gromacs-2022.4/src/gromacs/utility/mdmodulesnotifiers.h", line 110: error: this declaration has no storage class or type specifier
      std::int64_t energyCalculationIntervalInSteps() const
      ^

"/shared/tools/gromacs-2022.4/src/gromacs/utility/mdmodulesnotifiers.h", line 110: error: expected a ";"
      std::int64_t energyCalculationIntervalInSteps() const
           ^

"/shared/tools/gromacs-2022.4/src/gromacs/utility/mdmodulesnotifiers.h", line 121: warning: parsing restarts here after previous syntax error [end_of_flush]
      const std::int64_t energyCalculationIntervalInSteps_;
                                                          ^

Remark: individual warnings can be suppressed with "--diag_suppress <warning-name>"

"/shared/tools/gromacs-2022.4/src/gromacs/utility/mdmodulesnotifiers.h", line 106: error: "energyCalculationIntervalInSteps_" is not a nonstatic data member or base class of class "gmx::EnergyCalculationFrequencyErrors"
          energyCalculationIntervalInSteps_(energyCalculationIntervalInSteps)
          ^

"/shared/tools/gromacs-2022.4/src/gromacs/fileio/checkpoint.cpp", line 114: error: expected an identifier
  template void readKvtCheckpointValue(compat::not_null<std::int64_t*> value,
                                                             ^

"/shared/tools/gromacs-2022.4/src/gromacs/fileio/checkpoint.cpp", line 114: error: invalid combination of type specifiers
  template void readKvtCheckpointValue(compat::not_null<std::int64_t*> value,
                                                        ^

"/shared/tools/gromacs-2022.4/src/gromacs/fileio/checkpoint.cpp", line 132: error: expected an identifier
  template void writeKvtCheckpointValue(const std::int64_t&       value,
                                                   ^

"/shared/tools/gromacs-2022.4/src/gromacs/fileio/checkpoint.cpp", line 132: error: explicit type is missing ("int" assumed)
  template void writeKvtCheckpointValue(const std::int64_t&       value,
                                              ^

"/shared/tools/gromacs-2022.4/src/gromacs/fileio/checkpoint.cpp", line 132: error: expected a ")"
  template void writeKvtCheckpointValue(const std::int64_t&       value,
                                                   ^

"/shared/tools/gromacs-2022.4/src/gromacs/fileio/checkpoint.cpp", line 135: warning: parsing restarts here after previous syntax error [end_of_flush]
                                        KeyValueTreeObjectBuilder kvtBuilder);
                                                                            ^

"/shared/tools/gromacs-2022.4/src/gromacs/fileio/checkpoint.cpp", line 132: error: no instance of function template "gmx::writeKvtCheckpointValue" matches the specified type
  template void writeKvtCheckpointValue(const std::int64_t&       value,
                ^

"/shared/tools/gromacs-2022.4/src/gromacs/fileio/checkpoint.cpp", line 1203: error: argument of type "int64_t *" is incompatible with parameter of type "long long *"
          do_cpt_step_err(xd, "step", &contents->step, list);
                                      ^

21 errors detected in the compilation of "/shared/tools/gromacs-2022.4/src/gromacs/fileio/checkpoint.cpp".

Regards,

mpicc --version

nvc 23.5-0 linuxarm64 target on aarch64 Linux -tp neoverse-v1
NVIDIA Compilers and Tools
Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

Hi juntang,

The “cstdint” header file, which is where these symbols would be defined, would be coming from your system headers.

What g++ do you have installed? Is it an older version which doesn’t support C++17?

-Mat

Mat,

gcc --version
gcc (Ubuntu 11.1.0-1ubuntu1~20.04) 11.1.0
Copyright (C) 2021 Free Software Foundation, Inc

I believe it supports c++17 because I can compile Gromacs with GCC-11.

I grabbed the Gromacs package and was able to reproduce the error.

Looks to be an issue with the header file “src/gromacs/fileio/xdrf.h” where they define “int64_t” to be a “long long”:

#ifdef __PGI /*Portland group compiler*/
#    define int64_t long long
#endif

For compatibility, we still define “__PGI” and hence this gets included which in turn causes your errors.

I’m not very familiar with gromacs myself, so don’t have a recommended solution, but you might try commenting out this line to see if you get further.

1 Like

Mat,

This fixes the compiling problem for me. BTW, do you know what’s the recommended blas/lapack library for nvhpc?

It’s what ever you like but we do ship prepackaged versions which you can use.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.