Openpmd-api: Build problem when trying to install with MSVC without MPI

Created on 16 Jun 2021  路  3Comments  路  Source: openPMD/openPMD-api

Setup

Performed steps
I'm using Visual Studio 2019 and it's CMake toolchain for windows

cmake .. -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_INSTALL_PREFIX:PATH="C:\workspace\Codes\openPMD-api\install\Win" -DopenPMD_USE_MPI:STRING="OFF" -DopenPMD_USE_HDF5:STRING="ON" -DopenPMD_USE_PYTHON:STRING="OFF" -DopenPMD_INSTALL:STRING="ON"

and

cmake --build .

led to the following output/problem during install

C:\workspace\Codes\openPMD-api\include\openPMD\IO\AbstractIOHandler.hpp(29): fatal error C1083: Cannot open include file: 'mpi.h': No such file or directory

(And many other files like this)

System environment

  • operating system: Windows 10 Build 19042
  • machine: Personal Laptop

Problem

I'm trying to install openPMD on Windows using the Visual Studio IDE, which is usually very convenient to set up CMake installations.
Even though I specified openPMD_USE_MPI=OFF, which works during the prebuild phase since it never tries to find the MPI module, then I saw that in the actual code I get openPMD_HAVE_MPI=1, so it tries to include mpi.h, which I don't have.

I found a workaround that let me build and install it by adding

add_compile_definitions(openPMD_HAVE_MPI=0)

in the appropriate lines (146 of the latest dev branch) of the CMakeLists.txt'. My guess is that eventually the ``` set(openPMD_HAVE_MPI FALSE) ```` command doesn't result in a defined variable in the code when using the Microsoft compiler so in theconfig.hpp` file it force-defines it to be 1.
Anyway, I could make it build using the workaround, but I'm not sure if I was doing something wrong instead.

Thank you!

install machinsystem question

Most helpful comment

After resetting Visual Studio and re-cloning openPMD, I couldn't reproduce the issue.
It must have been some messed up cached variable, now everything works fine.
Thanks!

All 3 comments

Hi @titoiride,

Thanks for checking and reporting this! Please excuse the delay in answering, due to a deadline that occupied me last week.

I cannot reproduce this locally yet. Can we try to dig deeper?
Can you add a message(STATUS "+++++ ${openPMD_HAVE_MPI} +++++") before the configure_file call here?
https://github.com/openPMD/openPMD-api/blob/04d50c8c7f9793fb1e7829000411a48309d220f2/CMakeLists.txt#L836-L840
What does that line print?

We can also look together into this via Zoom (see Slack ping).

After resetting Visual Studio and re-cloning openPMD, I couldn't reproduce the issue.
It must have been some messed up cached variable, now everything works fine.
Thanks!

Thanks for testing & confirming.
Don't hesitate to check in again if anything should be flaky in VS.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KseniaBastrakova picture KseniaBastrakova  路  6Comments

lucafedeli88 picture lucafedeli88  路  3Comments

ax3l picture ax3l  路  7Comments

ax3l picture ax3l  路  3Comments

psychocoderHPC picture psychocoderHPC  路  3Comments