openPMD / openPMD-api

:floppy_disk: C++ & Python API for Scientific I/O
https://openpmd-api.readthedocs.io
GNU Lesser General Public License v3.0
138 stars 51 forks source link

Spack: Multiple Packages (WarpX install) #1249

Open ZahraRe2021 opened 2 years ago

ZahraRe2021 commented 2 years ago

Hi, i am trying to install openPMD on my ubuntu20.4, X64. I need it to visualize WarpX codes. I don't know why it is not possible to compile warpX with

make -j 4 USE_OPENPMD=TRUE

as described here: https://warpx.readthedocs.io/en/19.10/building/openpmd.html

So, I tried:

spack install openpmd-api
spack load openpmd-api

But I got this error:

Error: openpmd-api matches multiple packages.
  Matching packages:
    aulbntd openpmd-api@0.14.4%gcc@9.4.0 arch=linux-ubuntu20.04-ivybridge
    zx572t3 openpmd-api@0.14.4%gcc@9.4.0 arch=linux-ubuntu20.04-ivybridge

Thanks for your help.

ax3l commented 2 years ago

Hey @ZahraRe2021,

Thank you for reaching out and the detailed report.

We transitioned WarpX to use cmake last year. From your link, it looks like you try to build the October 2019 release of WarpX, which is outdated.

Please follow the guidance here to do a developer install with spack: https://warpx.readthedocs.io/en/22.04/install/cmake.html

  1. use a spack virtual environment (instead of spack load) https://warpx.readthedocs.io/en/22.04/install/dependencies.html#spack-macos-linux
  2. compile with CMake: https://warpx.readthedocs.io/en/22.04/install/cmake.html#compile
    
    # find dependencies & configure
    #   we will download AMReX, PICSAR and openPMD-api for your automatically and by default
    cmake -S . -B build

compile, here we use four threads but you can use more if you have a stronger CPU

cmake --build build -j 4



All build options are documented here, as you see openPMD is on by default: https://warpx.readthedocs.io/en/22.04/install/cmake.html#build-options

Let me know if you encounter an issues with these steps :)