AMReX-Fluids / IAMR

A parallel, adaptive mesh refinement (AMR) code that solves the variable-density incompressible Navier-Stokes equations.
https://amrex-fluids.github.io/IAMR/
79 stars 57 forks source link

Compile error in Getting Started #131

Closed 49takashi closed 2 years ago

49takashi commented 2 years ago

Hi,

I'm trying to run IAMR following Getting Started. When I execute make, I encountered the following error

Compiling AMReX_MLEBNodeFDLaplacian.cpp ...
g++ -MMD -MP  -Werror=return-type -g -O3 -std=c++14  -pthread    -DBL_SPACEDIM=2 -DAMREX_SPACEDIM=2 -DBL_FORT_USE_UNDERSCORE -DAMREX_FORT_USE_UNDERSCORE -DBL_Linux -DAMREX_Linux -DNDEBUG -DAMREX_NO_PROBINIT -Itmp_build_dir/s/2d.gnu.EXE -I. -I. -I../../Source -I../../Source/prob -I../../Source/Utilities -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/Slopes -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/Utils -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/MOL -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/Godunov -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/BDS -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/Projections -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/Base -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/Base/Parser -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/AmrCore -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/Amr -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/Boundary -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/LinearSolvers/MLMG -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Tools/C_scripts  -c /dfs/user/takashi279/plasma/design/multiscale/amrex/Src/LinearSolvers/MLMG/AMReX_MLEBNodeFDLaplacian.cpp -o tmp_build_dir/o/2d.gnu.EXE/AMReX_MLEBNodeFDLaplacian.o
In file included from /dfs/user/takashi279/plasma/design/multiscale/amrex/Src/LinearSolvers/MLMG/AMReX_MLEBNodeFDLaplacian.cpp:1:0:
/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/LinearSolvers/MLMG/AMReX_MLEBNodeFDLaplacian.H:122:71: error: array must be initialized with a brace-enclosed initializer
     GpuArray<Real,AMREX_SPACEDIM> m_sigma{AMREX_D_DECL(1_rt,1_rt,1_rt)};
                                                                       ^
/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/LinearSolvers/MLMG/AMReX_MLEBNodeFDLaplacian.H:122:71: error: too many initializers for ‘amrex::GpuArray<double, 2u>’
/dfs/user/takashi279/plasma/design/multiscale/amrex/Tools/GNUMake/Make.rules:255: recipe for target 'tmp_build_dir/o/2d.gnu.EXE/AMReX_MLEBNodeFDLaplacian.o' failed
make: *** [tmp_build_dir/o/2d.gnu.EXE/AMReX_MLEBNodeFDLaplacian.o] Error 1

The options I set in the GNUMakefile is as follows:

#AMREX_HOME defines the directory in which we will find the BoxLib directory
AMREX_HOME=/dfs/user/takashi279/plasma/design/multiscale/amrex
AMREX_HYDRO_HOME=/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro

#TOP defines the directory in which we will find Source, Exec, etc.
TOP = ../..

#
# Variables for the user to set ...
#

PRECISION   = DOUBLE

DIM         = 2
COMP        = gnu

DEBUG       = FALSE
USE_MPI     = FALSE
USE_OMP     = FALSE
PROFILE     = FALSE

USE_CUDA = FALSE

USE_SENSEI_INSITU = FALSE

EBASE = amr

Blocs   := .

include $(TOP)/Exec/Make.IAMR

Am I missing any dependencies? Any help would be really appreciated.

WeiqunZhang commented 2 years ago

What version of gcc are you using? Could you try to add an extra pair of braces to the line in AMReX_MLEBNodeFDLaplacian.H?

GpuArray<Real,AMREX_SPACEDIM> m_sigma{{AMREX_D_DECL(1_rt,1_rt,1_rt)}};
49takashi commented 2 years ago

Thank you @WeiqunZhang for the reply. The version of GCC is 12.1.0:

(amrex) takashi279@hyperturing1:/dfs/user/takashi279/plasma/design/multiscale/IAMR/Exec/eb_run2d$ gcc --version
gcc (conda-forge gcc 12.1.0-16) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.

As you suggested, after I added an extra pair of braces to the line, it could successfully compile AMReX_MLEBNodeFDLaplacian.cpp. But, I got another error:

Compiling AMReX_EB2_IndexSpace_STL.cpp ...
g++ -MMD -MP  -Werror=return-type -g -O3 -std=c++14  -fopenmp -pthread    -DBL_USE_OMP -DAMREX_USE_OMP -DBL_SPACEDIM=2 -DAMREX_SPACEDIM=2 -DBL_FORT_USE_UNDERSCORE -DAMREX_FORT_USE_UNDERSCORE -DBL_Linux -DAMREX_Linux -DAMREX_USE_EB -DNDEBUG -DAMREX_NO_PROBINIT -Itmp_build_dir/s/2d.gnu.OMP.EXE -I. -I. -I../../Source -I../../Source/prob -I../../Source/Utilities -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/Slopes -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/Utils -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/MOL -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/Godunov -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/BDS -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/Projections -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/Redistribution -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/EBMOL -I/dfs/user/takashi279/plasma/design/multiscale/AMReX-Hydro/EBGodunov -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/Base -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/Base/Parser -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/AmrCore -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/Amr -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/Boundary -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/LinearSolvers/MLMG -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Src/EB -I/dfs/user/takashi279/plasma/design/multiscale/amrex/Tools/C_scripts  -c /dfs/user/takashi279/plasma/design/multiscale/amrex/Src/EB/AMReX_EB2_IndexSpace_STL.cpp -o tmp_build_dir/o/2d.gnu.OMP.EXE/AMReX_EB2_IndexSpace_STL.o
/dfs/user/takashi279/plasma/design/multiscale/amrex/Tools/C_scripts/makebuildinfo_C.py \
          --amrex_home "/dfs/user/takashi279/plasma/design/multiscale/amrex" \
          --COMP "gnu" --COMP_VERSION "5.5.0" \
          --FCOMP "" --FCOMP_VERSION "" \
          --GIT "../.. /dfs/user/takashi279/plasma/design/multiscale/amrex"
  File "/dfs/user/takashi279/plasma/design/multiscale/amrex/Tools/C_scripts/makebuildinfo_C.py", line 441
    newline = line.replace(f"@@{keyword}@@",
                                          ^
SyntaxError: invalid syntax
../../Exec/Make.IAMR:82: recipe for target 'AMReX_buildInfo.cpp' failed
make: *** [AMReX_buildInfo.cpp] Error 1

Is it due to the inconsistency of versions of GCC or other packages?

WeiqunZhang commented 2 years ago

We will make some changes to make sure amrex works with gcc 12.

The new error is in python. @zingale do you have any ideas?

zingale commented 2 years ago

can you tell me what version of python you are using?

zingale commented 2 years ago

I was able to build eb_run2d without issues (didn't need to make the change above) with GCC 12.1.0 and python 3.10.5

zingale commented 2 years ago

it is crashing on the first f-string -- you will need to make sure that you are using python 3.6 or later.

49takashi commented 2 years ago

Thank you @zingale for the advice. The version of python was 3.5. After I upgraded the version to 3.10.5, all the compilation was done (with extra pair of braces)! But, if I don't add the braces, the same error at the top happened on my environment...

zingale commented 2 years ago

great.

Not sure about that file problem (turns out I'm using GCC 12.1.1, but I double the x.x.1 makes a diff)

WeiqunZhang commented 2 years ago

I cannot reproduce it with GCC 12.1.0. Anyway, it wouldn't hurt to add an extra pair of braces in that place.

WeiqunZhang commented 2 years ago

My understanding is double braces are no longer required since C++14.