ECP-WarpX / impactx

high-performance modeling of beam dynamics in particle accelerators with collective effects
https://impactx.readthedocs.io
Other
26 stars 20 forks source link

Error message #574

Closed zhangli28 closed 6 months ago

zhangli28 commented 6 months ago

I can install impactX using conda. When I run the chicane example file, I get error:

AMReX (22.10-1-g13aa4df0f5a4) initialized boxArray(0) (BoxArray maxbox(1) m_ref->m_hash_sig(0) ((0,0,0) (7,7,7) (0,0,0)) )

Traceback (most recent call last): File "/sqfs/home/zhangli4/ImpactX/Test1/run_chicane.py", line 30, in ref.set_charge_qe(-1.0).set_mass_MeV(0.510998950).set_kin_energy_MeV(kin_energy_MeV) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'impactx.impactx_pybind.RefPart' object has no attribute 'set_kin_energy_MeV'. Did you mean: 'set_energy_MeV'?

zhangli28 commented 6 months ago

If I change 'set_kin_energy_MeV' to 'set_energy_MeV' again I get error:

AMReX (22.10-1-g13aa4df0f5a4) initialized boxArray(0) (BoxArray maxbox(1) m_ref->m_hash_sig(0) ((0,0,0) (7,7,7) (0,0,0)) )

Traceback (most recent call last): File "/gpfs/home/ncpathak/Year2024/ImpactX/Test1/run_example.py", line 34, in distr = distribution.Waterbag( ^^^^^^^^^^^^^^^^^^^^^^ TypeError: init(): incompatible constructor arguments. The following argument types are supported:

  1. impactx.impactx_pybind.distribution.Waterbag(sigmaX: float, sigmaY: float, sigmaT: float, sigmaPx: float, sigmaPy: float, sigmaPt: float, muxpx: float = 0.0, muypy: float = 0.0, mutpt: float = 0.0)

Invoked with: kwargs: lambdaX=2.2951017632e-05, lambdaY=1.3084093142e-05, lambdaT=5.5555553e-08, lambdaPx=1.598353425e-06, lambdaPy=2.803697378e-06, lambdaPt=2e-06, muxpx=0.93334560620306, muypy=0.93334560620306, mutpt=0.999999961419755

n01r commented 6 months ago

Hi @zhangli28, welcome! Thank you for using ImpactX and opening this issue! :slightly_smiling_face:

We recently introduced a breaking change in the inputs of our particle distributions. The pull request that introduced this is here: https://github.com/ECP-WarpX/impactx/pull/552

The gist is that we renamed all the sigma to lambda because our distribution input takes the axis intercepts of the phase space ellipse, and sigma rather indicates the standard deviation/maximum extent of the ellipse. https://impactx.readthedocs.io/en/latest/theory/intro.html#beam-distribution-input

Did you have a previous version of ImpactX installed in your Python modules and then you maybe did an update and haven't updated the Python module, yet? https://impactx.readthedocs.io/en/latest/install/cmake.html#compile

zhangli28 commented 6 months ago

Hi @n01r , thank you for answering. This is the first time I use Impact-X. There is no previous installation.

Could you tell me what should I do to fix the error ?

are you going to change the run_chicane.py file ?

do you think its a conda installation issue. may be conda is not updated ?

Thank you.

n01r commented 6 months ago

Yea, let's figure out what happens in your case. :slightly_smiling_face:

Which method did you choose for the installation of ImpactX?

Did you use a package manager (e.g. conda, ...) for a user-type installation? Or did you build ImpactX from source? Is it your local machine or a cluster?

zhangli28 commented 6 months ago

@n01r , I just use the command (conda create -n impactx -c conda-forge impactx) to install.

I am using cluster.

For job submission, I use source activate impactx in the job script file and submit the job on single core (because MPI is not supported with conda).

n01r commented 6 months ago

Thank you, @zhangli28!

Let me try to reproduce that.

For now, can you try to replace all occurrences of lambda with sigma in your run_chicane.py or other Python run-file that you want to use? (E.g. lambdaPx back to sigmaPx) Maybe this will immediately let you run the code.

On another note, would you happen to be on any of the supercomputers listed here? https://warpx.readthedocs.io/en/latest/install/hpc.html#hpc-machines

The ImpactX dependencies are fairly similar to the WarpX dependencies and so you could try to build the code from source instead, after loading the dependencies from a profile file and installing the rest. This would ensure that you have the most recent features of ImpactX.

zhangli28 commented 6 months ago

@n01r , I did as you wrote. I changed as below

#ref.set_charge_qe(-1.0).set_mass_MeV(0.510998950).set_kin_energy_MeV(kin_energy_MeV)
ref.set_charge_qe(-1.0).set_mass_MeV(0.510998950).set_energy_MeV(kin_energy_MeV)
distr = distribution.Waterbag(
    sigmaX=2.2951017632e-5,
    sigmaY=1.3084093142e-5,
    sigmaT=5.5555553e-8,
    sigmaPx=1.598353425e-6,
    sigmaPy=2.803697378e-6,
    sigmaPt=2.000000000e-6,
    muxpx=0.933345606203060,
    muypy=0.933345606203060,
    mutpt=0.999999961419755,
)

but now there is new error message

AMReX (22.10-1-g13aa4df0f5a4) initialized boxArray(0) (BoxArray maxbox(1) m_ref->m_hash_sig(0) ((0,0,0) (7,7,7) (0,0,0)) )

Traceback (most recent call last): File "/gpfs/home/ncpathak/Year2024/ImpactX/Test1/run_chicane.py", line 48, in monitor = elements.BeamMonitor("monitor", backend="h5") ^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'impactx.impactx_pybind.elements' has no attribute 'BeamMonitor'

n01r commented 6 months ago

I see, it does look like there is a mismatch between the conda package and the examples. Pinging @ax3l (who is currently on travel). I was able to reproduce the behavior you saw when I tried to run the chicane example from the current development branch in a conda environment installed via the user installation.

I think installing it from source is a good alternative to get around this issue for now. I assume that you cloned the GitHub repository, correct? That is where you found the example files and then tried to run them?

Can you create another conda-environment like described here? It will install the dependencies like cmake for building from source. https://impactx.readthedocs.io/en/latest/install/dependencies.html#conda-linux-macos-windows

Then load the environment and try to build the code like described here: https://impactx.readthedocs.io/en/latest/install/cmake.html#developers

After the final cmake --build build --target pip_install -j 4 your conda environment will have the most recent version of PyImpactX and there will not be a mismatch between the provided examples and the code version anymore.

Which cluster are you working on at the moment? Maybe we already have profiles for this one or have someone who has access as well.

zhangli28 commented 6 months ago
I assume that you cloned the GitHub repository, correct? That is where you found the example files and then tried to run them?

I just used the command conda create -n impactx -c conda-forge impactx to install

Can you create another conda-environment like described here? It will install the dependencies like cmake for building from source.
https://impactx.readthedocs.io/en/latest/install/dependencies.html#conda-linux-macos-windows

I will try your method and if there is something wrong in installation, I will report. please note that it is a small local cluster (256 CPU cores) build by the department for computation.

I have a question for you, which may help me to learn the procedure correctly

Question: Suppose if you have to install impactX on your local cluster how will you proceed ?

n01r commented 6 months ago

Certainly :+1: , the developer installation instructions (https://impactx.readthedocs.io/en/latest/install/cmake.html#developers) are already good for running on multiple nodes of your local cluster if you installed MPI into your conda environment like the instructions say, and then compile the code with -DImpactX_MPI=ON (default). We also support running on GPUs, so dependending on what vendor they are from you would need the dependencies like CUDA Toolkit or ROCm, etc.

We provide cluster-specific profiles for some of the large compute clusters around the world (https://impactx.readthedocs.io/en/latest/install/hpc.html) because certain software has been optimized and tuned for these large-scale machines and so we would rather use this software than pre-built binaries that are less specialized to where they are running.

zhangli28 commented 6 months ago

@n01r , thank you.

Let me try your idea. If I fail, I will come back to seek more help.

n01r commented 6 months ago

Sounds good! Hope it works out :)

zhangli28 commented 6 months ago

@n01r one question before new installation

The cluster already has openmpi for parallel programing. Do I require to use the mpich in the installation command below ? Will it conflict with openmpi ?

conda create -n impactx-cpu-mpich-dev -c conda-forge blaspp boost ccache cmake compilers git lapackpp "openpmd-api=*=mpi_mpich*" python numpy pandas quantiphy scipy yt pkg-config matplotlib mamba ninja mpich pip virtualenv
conda activate impactx-cpu-mpich-dev
zhangli28 commented 6 months ago

When I used the command

conda create -n impactx-cpu-mpich-dev -c conda-forge blaspp boost ccache cmake compilers git lapackpp "openpmd-api=*=mpi_mpich*" python numpy pandas quantiphy scipy yt pkg-config matplotlib mamba ninja mpich pip virtualenv

I got the following error

Collecting package metadata: done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - quantiphy

Current channels:

  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/free/linux-64
  - https://repo.anaconda.com/pkgs/free/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org
zhangli28 commented 6 months ago

Hi @n01r , eventually I can proceed.

When I used the command cmake -S . -B build -DImpactX_PYTHON=ON I got the following error

-- The C compiler identification is GNU 8.5.0
-- The CXX compiler identification is GNU 8.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find CCache
-- Downloading ABLASTR ...
-- ABLASTR repository: https://github.com/ECP-WarpX/WarpX.git (24.04)
-- Downloading AMReX ...
-- AMReX repository: https://github.com/AMReX-Codes/amrex.git (24.04)
-- CMake version: 3.20.2
-- AMReX installation directory: /usr/local
-- Build type set by user to 'Release'.
-- Building AMReX with AMReX_SPACEDIM = 3
-- Configuring AMReX with the following options enabled: 
--    AMReX_BUILD_SHARED_LIBS
--    AMReX_PRECISION = DOUBLE
--    AMReX_MPI
--    AMReX_MPI_THREAD_MULTIPLE
--    AMReX_OMP
--    AMReX_LINEAR_SOLVERS
--    AMReX_PARTICLES
--    AMReX_PARTICLES_PRECISION = DOUBLE
--    AMReX_PIC
--    AMReX_TINY_PROFILE
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Could NOT find MPI_C (missing: MPI_C_LIB_NAMES MPI_C_HEADER_DIR MPI_C_WORKS) 
-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS) 
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND C CXX)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindMPI.cmake:1742 (find_package_handle_standard_args)
  build/_deps/fetchedamrex-src/Tools/CMake/AMReXParallelBackends.cmake:23 (find_package)
  build/_deps/fetchedamrex-src/Src/CMakeLists.txt:40 (include)

-- Configuring incomplete, errors occurred!
See also "/sqfs/home/zhangli4/ImpactX/Installation/impactx/build/CMakeFiles/CMakeOutput.log".
See also "/sqfs/home/zhangli4/ImpactX/Installation/impactx/build/CMakeFiles/CMakeError.log".
n01r commented 6 months ago

Hi @zhangli28, it looks like your environment is not yet configured correctly. The CMake output does not seem to show any paths to your impactx conda environment.

Did you manage to successfully install that and fix the error you showed above? Is the environment active and what does mpicc --version show?

You may have to set the paths manually. It may also be that on your cluster paths are set automatically when you start a new shell session. Does which python point at your environment's Python executable?

zhangli28 commented 6 months ago

Hi @n01r , I am still not able to fix the problem.

Let me tell you how I did (following your previous suggestion):

first, I create the impactx-cpu environment and install some packages.

conda create -n impactx-cpu -c conda-forge blaspp boost ccache cmake compilers git lapackpp "openpmd-api=*=mpi_mpich*" python numpy pandas scipy yt pkg-config matplotlib mamba ninja mpich pip virtualenv

source activate impactx-cpu

python3 -m pip install -U quantiphy   # quantiphy can not be installed via conda

then, I clone impactx

git clone https://github.com/ECP-WarpX/impactx.git

then, I enter in impactx directory

cd impactx

then, I perform as given in the documentation

source activate impactx-cpu
python3 -m pip install -U pip
python3 -m pip install -U build packaging seuptools wheel pytest
python3 -m pip install -U -r examples/requirements.txt

finally, I tried to build using cmake

source activate impactx-cpu
cmake -S . -B build -DImpactX_PYTHON=ON
n01r commented 6 months ago

Thanks, @zhangli28,

what are the outputs of

echo $PATH
mpicc --version
which python

?

zhangli28 commented 6 months ago

echo $PATH gave

/sqfs/home/zhangli4/conda_env/impactx-cpu/bin:/gpfs/software/Anaconda3/condabin:/gpfs/software/Anaconda3/bin:/cm/local/apps/environment-modules/4.5.3//bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/cm/local/apps/environment-modules/current/bin:/opt/dell/srvadmin/bin:/sqfs/home/zhangli4/bin

mpicc --version gave

x86_64-conda-linux-gnu-cc (conda-forge gcc 10.4.0-19) 10.4.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

which python gave

~/conda_env/impactx-cpu/bin/python
n01r commented 6 months ago

What is the output of which cmake?

What happens if you try to execute the cmake installation command with

cmake -DMPI_C_COMPILER=/sqfs/home/zhangli4/conda_env/impactx-cpu/bin/mpicc -DMPI_CXX_COMPILER=/sqfs/home/zhangli4/conda_env/impactx-cpu/bin/mpicxx -S . -B build -DImpactX_PYTHON=ON -DPython_EXECUTABLE=~/conda_env/impactx-cpu/bin/python
zhangli28 commented 6 months ago

which cmake gave

~/conda_env/impactx-cpu/bin/cmake

and when I execute the cmake installation command (as you suggest), it gave

-- Found CCache: /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/ccache
-- Downloading ABLASTR ...
-- ABLASTR repository: https://github.com/ECP-WarpX/WarpX.git (24.04)
-- Downloading AMReX ...
-- AMReX repository: https://github.com/AMReX-Codes/amrex.git (24.04)
-- CMake version: 3.25.0
-- AMReX installation directory: /usr/local
-- Build type set by user to 'Release'.
-- Building AMReX with AMReX_SPACEDIM = 3
-- Configuring AMReX with the following options enabled: 
--    AMReX_BUILD_SHARED_LIBS
--    AMReX_PRECISION = DOUBLE
--    AMReX_MPI
--    AMReX_MPI_THREAD_MULTIPLE
--    AMReX_OMP
--    AMReX_LINEAR_SOLVERS
--    AMReX_PARTICLES
--    AMReX_PARTICLES_PRECISION = DOUBLE
--    AMReX_PIC
--    AMReX_TINY_PROFILE
-- Could NOT find MPI_C (missing: MPI_C_WORKS) 
-- Could NOT find MPI_CXX (missing: MPI_CXX_WORKS) 
CMake Error at /sqfs/home/zhangli4/conda_env/impactx-cpu/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND C CXX)
Call Stack (most recent call first):
  /sqfs/home/zhangli4/conda_env/impactx-cpu/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /sqfs/home/zhangli4/conda_env/impactx-cpu/share/cmake-3.25/Modules/FindMPI.cmake:1837 (find_package_handle_standard_args)
  build/_deps/fetchedamrex-src/Tools/CMake/AMReXParallelBackends.cmake:23 (find_package)
  build/_deps/fetchedamrex-src/Src/CMakeLists.txt:40 (include)

-- Configuring incomplete, errors occurred!
n01r commented 6 months ago

I am sorry to hear that it continues to be annoying ...

What happens when you try your cmake -S . -B build command with -DImpactX_MPI=OFF?

zhangli28 commented 6 months ago

Hi @n01r , may be there is some progress but I could not say exactly.

cmake -S . -B build command with -DImpactX_MPI=OFF gave the following

-- Found CCache: /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/ccache
-- Downloading ABLASTR ...
-- ABLASTR repository: https://github.com/ECP-WarpX/WarpX.git (24.04)
-- Downloading AMReX ...
-- AMReX repository: https://github.com/AMReX-Codes/amrex.git (24.04)
-- CMake version: 3.25.0
-- AMReX installation directory: /usr/local
-- Build type set by user to 'Release'.
-- Building AMReX with AMReX_SPACEDIM = 3
-- Configuring AMReX with the following options enabled: 
--    AMReX_BUILD_SHARED_LIBS
--    AMReX_PRECISION = DOUBLE
--    AMReX_OMP
--    AMReX_LINEAR_SOLVERS
--    AMReX_PARTICLES
--    AMReX_PARTICLES_PRECISION = DOUBLE
--    AMReX_PIC
--    AMReX_TINY_PROFILE
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5") found components: CXX 
-- AMReX configuration summary: 
--    Build type               = Release
--    Install directory        = /usr/local
--    C++ compiler             = /usr/bin/c++
--    C++ defines              = -DAMREX_SPACEDIM=3
--    C++ flags                = -O3 -DNDEBUG  -pthread -fopenmp -Werror=return-type
--    C++ include paths        = -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/Base -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/Base/Parser -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/Boundary -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/AmrCore -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/LinearSolvers -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/LinearSolvers/MLMG -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/LinearSolvers/OpenBC -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/Particle
--    Link line                = -pthread /usr/lib/gcc/x86_64-redhat-linux/8/libgomp.so /usr/lib64/libpthread.so
-- AMReX: Using version '24.04' (24.04)
-- Downloading openPMD-api ...
-- openPMD-api repository: https://github.com/openPMD/openPMD-api.git (0.15.1)
-- Using the single-header code from /sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedopenpmd-src/share/openPMD/thirdParty/json/single_include/
-- nlohmann-json: Using INTERNAL version '3.9.1'
-- toml11: Using INTERNAL version '3.7.1'
-- HDF5 C compiler wrapper is unable to compile a minimal HDF5 program.
-- Found HDF5: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libhdf5.so (found version "1.12.2") found components: C 
CMake Warning at build/_deps/fetchedopenpmd-src/CMakeLists.txt:370 (message):
  Found only parallel version of HDF5 but no MPI.  Either set
  openPMD_USE_MPI=ON to force using MPI or set openPMD_USE_HDF5=OFF to
  disable HDF5 or provide a serial install of HDF5.

  If you manually installed a version of HDF5 in a non-default path, add its
  installation prefix to the environment variable CMAKE_PREFIX_PATH to find
  it: https://cmake.org/cmake/help/latest/envvar/CMAKE_PREFIX_PATH.html

-- Found MPI_C: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libmpi.so (found version "4.0") 
-- Found MPI_CXX: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libmpicxx.so (found version "4.0") 
-- Found MPI: TRUE (found version "4.0")  
-- Found ADIOS2: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/cmake/adios2/adios2-config.cmake (found suitable version "2.8.3", minimum required is "2.7.0") found components: C CXX MPI 

openPMD build configuration:
  library Version: 0.15.1
  openPMD Standard: 1.1.0
  C++ Compiler: GNU 8.5.0 
    /usr/bin/c++

  Installation: OFF

  Build Type: Release
  Library: static
  CLI Tools: OFF
  Examples: OFF
  Testing: OFF
  Invasive Tests: OFF
  Internal VERIFY: ON
  Build Options:
    MPI: OFF
    HDF5: OFF
    ADIOS1: OFF
    ADIOS2: ON
    PYTHON: OFF
    CUDA_EXAMPLES: OFF

-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success

WarpX build configuration:
  Version: 24.04 (24.04)
  C++ Compiler: GNU 8.5.0 
    /usr/bin/c++

  Installation prefix: /usr/local
        bin: bin
        lib: lib64
    include: include
      cmake: lib64/cmake/WarpX

  Build type: Release
  Build options:
    APP: OFF
    ASCENT: OFF
    COMPUTE: OMP
    DIMS: 3
    Embedded Boundary: OFF
    IPO/LTO: OFF
    LIB: OFF
    MPI: OFF
    PARTICLE PRECISION: DOUBLE
    PRECISION: DOUBLE
    PSATD: OFF
    PYTHON: OFF
    OPENPMD: ON
    QED: OFF
    QED table generation: OFF
    QED tools: OFF
    SENSEI: OFF

-- ABLASTR: Using version '' ()
CMake Error at /sqfs/home/zhangli4/conda_env/impactx-cpu/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Python (missing: Python_INCLUDE_DIRS Interpreter
  Development.Module)
Call Stack (most recent call first):
  /sqfs/home/zhangli4/conda_env/impactx-cpu/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /sqfs/home/zhangli4/conda_env/impactx-cpu/share/cmake-3.25/Modules/FindPython.cmake:561 (find_package_handle_standard_args)
  CMakeLists.txt:121 (find_package)

-- Configuring incomplete, errors occurred!
n01r commented 6 months ago

This line says it is not using the C++ compiler from the conda environment

--    C++ compiler             = /usr/bin/c++

Does your cluster have a module system? Are there other things pre-loaded when you log on?

And now it even says that it found MPI when it did not find it before? Odd :thinking:

-- Found MPI_C: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libmpi.so (found version "4.0") 
-- Found MPI_CXX: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libmpicxx.so (found version "4.0") 
-- Found MPI: TRUE (found version "4.0") 

Btw, can you make sure that you remove the build directory between unsuccessful tries? I just want to exclude that maybe things that are already present complicate the process. :slightly_smiling_face:

This part is also interesting:

  Could NOT find Python (missing: Python_INCLUDE_DIRS Interpreter
  Development.Module)

Did you set the -DPython_EXECUTABLE option (https://impactx.readthedocs.io/en/latest/install/cmake.html#build-options) to your Python?

zhangli28 commented 6 months ago

@n01r ,

Does your cluster have a module system?

Yes, the cluster has a module system.

Before, I didn't removed the build directory. Now, I removed it and tried again with the command

cmake -DMPI_C_COMPILER=/sqfs/home/zhangli4/conda_env/impactx-cpu/bin/mpicc -DMPI_CXX_COMPILER=/sqfs/home/zhangli4/conda_env/impactx-cpu/bin/mpicxx -S . -B build -DImpactX_MPI=OFF -DImpactX_PYTHON=ON -DPython_EXECUTABLE=~/conda_env/impactx-cpu/bin/python

The error still exist !

zhangli28 commented 6 months ago

Further ....

I load the gcc module (module load gcc/11.2.0)

and now the C++ compiler is being used from the conda environment.

--    C++ compiler             = /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/x86_64-conda-linux-gnu-c++
n01r commented 6 months ago

Can you try logging on to a fresh shell and running module purge?

Then, try to start up your conda environment. You may need to load a Python module first before conda becomes available. Potentially, you can also start it up with source <path/to/conda/env/> activate.

Maybe this will allow the paths and environment variables to be set properly.

zhangli28 commented 6 months ago

here is the error message

-- The C compiler identification is GNU 10.4.0
-- The CXX compiler identification is GNU 10.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/x86_64-conda-linux-gnu-cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/x86_64-conda-linux-gnu-c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found CCache: /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/ccache
-- Downloading ABLASTR ...
-- ABLASTR repository: https://github.com/ECP-WarpX/WarpX.git (24.04)
-- Downloading AMReX ...
-- AMReX repository: https://github.com/AMReX-Codes/amrex.git (24.04)
-- CMake version: 3.25.0
-- AMReX installation directory: /usr/local
-- Build type set by user to 'Release'.
-- Building AMReX with AMReX_SPACEDIM = 3
-- Configuring AMReX with the following options enabled: 
--    AMReX_BUILD_SHARED_LIBS
--    AMReX_PRECISION = DOUBLE
--    AMReX_OMP
--    AMReX_LINEAR_SOLVERS
--    AMReX_PARTICLES
--    AMReX_PARTICLES_PRECISION = DOUBLE
--    AMReX_PIC
--    AMReX_TINY_PROFILE
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5") found components: CXX 
-- AMReX configuration summary: 
--    Build type               = Release
--    Install directory        = /usr/local
--    C++ compiler             = /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/x86_64-conda-linux-gnu-c++
--    C++ defines              = -DAMREX_SPACEDIM=3
--    C++ flags                = -O3 -DNDEBUG -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /sqfs/home/zhangli4/conda_env/impactx-cpu/include -pthread -fopenmp
--    C++ include paths        = -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/Base -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/Base/Parser -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/Boundary -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/AmrCore -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/LinearSolvers -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/LinearSolvers/MLMG -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/LinearSolvers/OpenBC -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/Particle
--    Link line                = -pthread /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libgomp.so /sqfs/home/zhangli4/conda_env/impactx-cpu/x86_64-conda-linux-gnu/sysroot/usr/lib/libpthread.so
-- AMReX: Using version '24.04' (24.04)
-- Downloading openPMD-api ...
-- openPMD-api repository: https://github.com/openPMD/openPMD-api.git (0.15.1)
-- Using the single-header code from /sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedopenpmd-src/share/openPMD/thirdParty/json/single_include/
-- nlohmann-json: Using INTERNAL version '3.9.1'
-- toml11: Using INTERNAL version '3.7.1'
-- HDF5 C compiler wrapper is unable to compile a minimal HDF5 program.
-- Found HDF5: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libhdf5.so (found version "1.12.2") found components: C 
CMake Warning at build/_deps/fetchedopenpmd-src/CMakeLists.txt:370 (message):
  Found only parallel version of HDF5 but no MPI.  Either set
  openPMD_USE_MPI=ON to force using MPI or set openPMD_USE_HDF5=OFF to
  disable HDF5 or provide a serial install of HDF5.

  If you manually installed a version of HDF5 in a non-default path, add its
  installation prefix to the environment variable CMAKE_PREFIX_PATH to find
  it: https://cmake.org/cmake/help/latest/envvar/CMAKE_PREFIX_PATH.html

-- Found MPI_C: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libmpi.so (found version "4.0") 
-- Found MPI_CXX: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libmpicxx.so (found version "4.0") 
-- Found MPI: TRUE (found version "4.0")  
-- Found ADIOS2: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/cmake/adios2/adios2-config.cmake (found suitable version "2.8.3", minimum required is "2.7.0") found components: C CXX MPI 

openPMD build configuration:
  library Version: 0.15.1
  openPMD Standard: 1.1.0
  C++ Compiler: GNU 10.4.0 
    /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/x86_64-conda-linux-gnu-c++

  Installation: OFF

  Build Type: Release
  Library: static
  CLI Tools: OFF
  Examples: OFF
  Testing: OFF
  Invasive Tests: OFF
  Internal VERIFY: ON
  Build Options:
    MPI: OFF
    HDF5: OFF
    ADIOS1: OFF
    ADIOS2: ON
    PYTHON: OFF
    CUDA_EXAMPLES: OFF

-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success

WarpX build configuration:
  Version: 24.04 (24.04)
  C++ Compiler: GNU 10.4.0 
    /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/x86_64-conda-linux-gnu-c++

  Installation prefix: /usr/local
        bin: bin
        lib: lib64
    include: include
      cmake: lib64/cmake/WarpX

  Build type: Release
  Build options:
    APP: OFF
    ASCENT: OFF
    COMPUTE: OMP
    DIMS: 3
    Embedded Boundary: OFF
    IPO/LTO: OFF
    LIB: OFF
    MPI: OFF
    PARTICLE PRECISION: DOUBLE
    PRECISION: DOUBLE
    PSATD: OFF
    PYTHON: OFF
    OPENPMD: ON
    QED: OFF
    QED table generation: OFF
    QED tools: OFF
    SENSEI: OFF

-- ABLASTR: Using version '' ()
CMake Error at /sqfs/home/zhangli4/conda_env/impactx-cpu/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Python (missing: Interpreter Development.Module) (found
  version "3.11.2")
Call Stack (most recent call first):
  /sqfs/home/zhangli4/conda_env/impactx-cpu/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /sqfs/home/zhangli4/conda_env/impactx-cpu/share/cmake-3.25/Modules/FindPython.cmake:561 (find_package_handle_standard_args)
  CMakeLists.txt:121 (find_package)

-- Configuring incomplete, errors occurred!
zhangli28 commented 6 months ago

Can you try logging on to a fresh shell and running module purge?

sure ...
zhangli28 commented 6 months ago

First, I logged out from the system. Open a new terminal and then I re-login. And then, follow as you wrote. Here is the result

-- The C compiler identification is GNU 10.4.0
-- The CXX compiler identification is GNU 10.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/x86_64-conda-linux-gnu-cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/x86_64-conda-linux-gnu-c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found CCache: /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/ccache
-- Downloading ABLASTR ...
-- ABLASTR repository: https://github.com/ECP-WarpX/WarpX.git (24.04)
-- Downloading AMReX ...
-- AMReX repository: https://github.com/AMReX-Codes/amrex.git (24.04)
-- CMake version: 3.25.0
-- AMReX installation directory: /usr/local
-- Build type set by user to 'Release'.
-- Building AMReX with AMReX_SPACEDIM = 3
-- Configuring AMReX with the following options enabled: 
--    AMReX_BUILD_SHARED_LIBS
--    AMReX_PRECISION = DOUBLE
--    AMReX_OMP
--    AMReX_LINEAR_SOLVERS
--    AMReX_PARTICLES
--    AMReX_PARTICLES_PRECISION = DOUBLE
--    AMReX_PIC
--    AMReX_TINY_PROFILE
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5") found components: CXX 
-- AMReX configuration summary: 
--    Build type               = Release
--    Install directory        = /usr/local
--    C++ compiler             = /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/x86_64-conda-linux-gnu-c++
--    C++ defines              = -DAMREX_SPACEDIM=3
--    C++ flags                = -O3 -DNDEBUG -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /sqfs/home/zhangli4/conda_env/impactx-cpu/include -pthread -fopenmp
--    C++ include paths        = -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/Base -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/Base/Parser -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/Boundary -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/AmrCore -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/LinearSolvers -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/LinearSolvers/MLMG -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/LinearSolvers/OpenBC -I/sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedamrex-src/Src/Particle
--    Link line                = -pthread /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libgomp.so /sqfs/home/zhangli4/conda_env/impactx-cpu/x86_64-conda-linux-gnu/sysroot/usr/lib/libpthread.so
-- AMReX: Using version '24.04' (24.04)
-- Downloading openPMD-api ...
-- openPMD-api repository: https://github.com/openPMD/openPMD-api.git (0.15.1)
-- Using the single-header code from /sqfs/home/zhangli4/Year2024/ImpactX/Installation/impactx/build/_deps/fetchedopenpmd-src/share/openPMD/thirdParty/json/single_include/
-- nlohmann-json: Using INTERNAL version '3.9.1'
-- toml11: Using INTERNAL version '3.7.1'
-- HDF5 C compiler wrapper is unable to compile a minimal HDF5 program.
-- Found HDF5: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libhdf5.so (found version "1.12.2") found components: C 
CMake Warning at build/_deps/fetchedopenpmd-src/CMakeLists.txt:370 (message):
  Found only parallel version of HDF5 but no MPI.  Either set
  openPMD_USE_MPI=ON to force using MPI or set openPMD_USE_HDF5=OFF to
  disable HDF5 or provide a serial install of HDF5.

  If you manually installed a version of HDF5 in a non-default path, add its
  installation prefix to the environment variable CMAKE_PREFIX_PATH to find
  it: https://cmake.org/cmake/help/latest/envvar/CMAKE_PREFIX_PATH.html

-- Found MPI_C: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libmpi.so (found version "4.0") 
-- Found MPI_CXX: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/libmpicxx.so (found version "4.0") 
-- Found MPI: TRUE (found version "4.0")  
-- Found ADIOS2: /sqfs/home/zhangli4/conda_env/impactx-cpu/lib/cmake/adios2/adios2-config.cmake (found suitable version "2.8.3", minimum required is "2.7.0") found components: C CXX MPI 

openPMD build configuration:
  library Version: 0.15.1
  openPMD Standard: 1.1.0
  C++ Compiler: GNU 10.4.0 
    /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/x86_64-conda-linux-gnu-c++

  Installation: OFF

  Build Type: Release
  Library: static
  CLI Tools: OFF
  Examples: OFF
  Testing: OFF
  Invasive Tests: OFF
  Internal VERIFY: ON
  Build Options:
    MPI: OFF
    HDF5: OFF
    ADIOS1: OFF
    ADIOS2: ON
    PYTHON: OFF
    CUDA_EXAMPLES: OFF

-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success

WarpX build configuration:
  Version: 24.04 (24.04)
  C++ Compiler: GNU 10.4.0 
    /sqfs/home/zhangli4/conda_env/impactx-cpu/bin/x86_64-conda-linux-gnu-c++

  Installation prefix: /usr/local
        bin: bin
        lib: lib64
    include: include
      cmake: lib64/cmake/WarpX

  Build type: Release
  Build options:
    APP: OFF
    ASCENT: OFF
    COMPUTE: OMP
    DIMS: 3
    Embedded Boundary: OFF
    IPO/LTO: OFF
    LIB: OFF
    MPI: OFF
    PARTICLE PRECISION: DOUBLE
    PRECISION: DOUBLE
    PSATD: OFF
    PYTHON: OFF
    OPENPMD: ON
    QED: OFF
    QED table generation: OFF
    QED tools: OFF
    SENSEI: OFF

-- ABLASTR: Using version '' ()
CMake Error at /sqfs/home/zhangli4/conda_env/impactx-cpu/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Python (missing: Interpreter Development.Module) (found
  version "3.11.2")
Call Stack (most recent call first):
  /sqfs/home/zhangli4/conda_env/impactx-cpu/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /sqfs/home/zhangli4/conda_env/impactx-cpu/share/cmake-3.25/Modules/FindPython.cmake:561 (find_package_handle_standard_args)
  CMakeLists.txt:121 (find_package)

-- Configuring incomplete, errors occurred!

looks like now it is only the problem of CMake

zhangli28 commented 6 months ago

Hi @n01r

Finally Done !!!

zhangli28 commented 6 months ago

Hi @n01r , as a final part, I did cmake --build build -j 4 and looks like clean build up.

Now, I am going to test the example files. I hope now I can be able to run some examples.

Thank you for helping me throughout the day. It was very appreciable.

n01r commented 6 months ago

Sweet! 🚀

Now it might be a good idea to create an impactx-cpu-mpich.profile and enter the workflow from a fresh shell in there so you don't have to remember how to get a working configuration. 🙂 The next time you log on you just source this profile.

zhangli28 commented 6 months ago

Hi @n01r , Just last question, now if I want to run the examples what should I do ?

with conda installation I directly used python3 run_chicane.py in the job-script file but now the procedure might be different ?

n01r commented 6 months ago

That depends on how you installed it. The command cmake --build build creates a binary file which you can use to run the app input files with (the ones without the .py suffix). If you also do cmake --build build --target pip_install it will create the Python module. Then you can run python <example>.py. :)

We aim to have the Python way be the default. But both are possible.

zhangli28 commented 6 months ago

Hi @n01r , it sounds great ! I will do as you said.

Now, I am closing this thread.

Thank you so much many times. If I will have any problem in running the example file, I will open a new thread.