setup-cpp icon indicating copy to clipboard operation
setup-cpp copied to clipboard

Brew LLVM OpenMP

Open aminya opened this issue 10 months ago • 7 comments

After the last release my MacOS pipelines are failing because OpenMP is not found anymore automatically: https://github.com/flatironinstitute/finufft/actions/runs/13840315537/job/38725974952 This was working until version 1.1.1 https://github.com/flatironinstitute/finufft/commit/dc2931afd39b2cdd3c7a67570a03cc33fa7bc405

Do I need to specify OpenMP to be installed?

Thanks, Marco

Originally posted by @DiamonDinoia in https://github.com/aminya/setup-cpp/issues/335#issuecomment-2729654481

aminya avatar Mar 17 '25 17:03 aminya

I wonder if it's because the LLVM installation via brew doesn't include OpenMP. I'll try to test. Could you pin setup-cpp meanwhile?

aminya avatar Mar 17 '25 17:03 aminya

Hi @aminya,

It seems that I still have problems: https://github.com/DiamonDinoia/finufft/actions/runs/14312541051

Do I need to export LD_LIBRARY_PATH after installing libomp?

Thanks, Marco

DiamonDinoia avatar Apr 07 '25 15:04 DiamonDinoia

If the issue still happens, the problem is somewhere else. Needs more investigation.

I disabled the export of the library path due to the conflicts with the system libraries, as the linker automatically picks those libraries. So, only add this if you intend to do so.

aminya avatar Apr 07 '25 17:04 aminya

@DiamonDinoia I could configure the project with this. CMake doesn't automatically pick up the homebrew libs.

brew install libomp
cmake -S . -B ./build -G 'Ninja Multi-Config' -DCMAKE_PREFIX_PATH="/opt/homebrew;/opt/homebrew/opt/libomp/"

I'll have to see how we can support this by default. Perhaps I should export LLVM_CMAKE_PREFIX_PATH that you can use in your builds

aminya avatar Apr 07 '25 18:04 aminya

@aminya my soluton is:

brew install libomp 
{
  echo "LDFLAGS=-L$(brew --prefix libomp)/lib"
  echo "CPPFLAGS=-I$(brew --prefix libomp)/include"
  echo "LIBRARY_PATH=$(brew --prefix libomp)/lib"
  echo "DYLD_LIBRARY_PATH=$(brew --prefix libomp)/lib"
  echo "CMAKE_PREFIX_PATH=$(brew --prefix libomp)"
} >> "$GITHUB_ENV"

It would be nice to have an openmp=true like vcvarsall

DiamonDinoia avatar Aug 18 '25 13:08 DiamonDinoia

I'll add OpenMP by default to the LLVM installations in the next release. The inconsistency between the platforms is not ideal

aminya avatar Aug 25 '25 07:08 aminya

Sometimes I use setup-cpp to install ninja and cmake only, leaving system compiler default. In apple case it is AppleClang. It would be great to be able to pass openmp there so to use it with AppleClang.

DiamonDinoia avatar Aug 25 '25 07:08 DiamonDinoia