CRPropa / CRPropa3

CRPropa is a public astrophysical simulation framework for propagating extraterrestrial ultra-high energy particles. https://crpropa.github.io/CRPropa3/
https://crpropa.desy.de
GNU General Public License v3.0
65 stars 66 forks source link

turbulent field not working - how to turn on the cmake option for turbulent field on MacOS? #447

Closed AlenaBakalova closed 7 months ago

AlenaBakalova commented 8 months ago

Hi everyone,

We have some troubles with CRPropa installation with my student. She has macos Ventura 13.5 on her laptop and we were able to install CRPropa. However, we found out that the turbulent field is not working and I guess its because we did not enable the FFTW3F during the cmake command during installation. When trying to fix this and compile the project with the option -DENABLE_FFTW3F=ON, after the cmake command we get a message "manually specified variables were not used by the project enable-fftw3f" and the following installation again doesnt not support the turbulent field. The fftw-devel are installed. The full cmake command we use is

cmake .. \ -DENABLE_GALACTICMAGNETICLENS=ON \ -DCMAKE_INSTALL_PREFIX=$CRPROPA_DIR \ -DPYTHON_EXECUTABLE=$PYTHON_DIR/bin/python$PYTHON_VERSION \ -DPYTHON_LIBRARY=$PYTHON_DIR/lib/libpython$PYTHON_VERSION.dylib \ -DPYTHON_INCLUDE_PATH=$PYTHON_DIR/include/python$PYTHON_VERSION \ -DCMAKE_C_COMPILER=$LLVM_DIR/bin/clang \ -DCMAKE_CXX_COMPILER=$LLVM_DIR/bin/clang++ \ -DOpenMP_CXX_FLAGS="-fopenmp -I$LLVM_DIR/lib/clang/$LLVM_VERSION/include" \ -DOpenMP_C_FLAGS="-fopenmp =libomp -I$LLVM_DIR/lib/clang/$LLVM_VERSION/include" \ -DOpenMP_libomp_LIBRARY=$LLVM_DIR/lib/libomp.dylib \ -DCMAKE_SHARED_LINKER_FLAGS="-L$LLVM_DIR/lib -lomp -Wl,-rpath,$LLVM_DIR/lib" \ -DOpenMP_C_LIB_NAMES=libomp \ -DOpenMP_CXX_LIB_NAMES=libomp \ -DNO_TCMALLOC=TRUE \ -DFFTW3F_LIBRARY= /opt/local/lib/libfftw3.dylib \ -DFFTW3F_INCLUDE_DIR=/opt/local/include \ -DENABLE_FFTW3F=ON

Is there something we are doing wrong? We first tried without the paths for the FFTW library and include but we were getting the same results. Thank you for any suggestions.

rafaelab commented 8 months ago

Hi @AlenaBakalova I can think of two things that might be causing the problem.

AlenaBakalova commented 8 months ago

hi @rafaelab, thank you for the quick response! I will pass these suggestions to the student and hopelfy it will work. Im pretty sure we cleaned the build folder, definitely at least the cmakecache was deleted, but we will try again and fix the libary location.

AlenaBakalova commented 7 months ago

So we tried both of the suggestions, removed the build directory and made a new one and replaced the path to the libfftw3f.dylib library. Even though during the compilation we get a message that FFTW3 was found, the cmake warning remains and it is compiled without the option. Any ideas why it is still ignored? Here is the whole output during the compilation:

` -- The Fortran compiler identification is GNU 13.2.0

-- The C compiler identification is Clang 15.0.7

-- The CXX compiler identification is Clang 15.0.7

-- Checking whether Fortran compiler has -isysroot

-- Checking whether Fortran compiler has -isysroot - yes

-- Checking whether Fortran compiler supports OSX deployment target flag

-- Checking whether Fortran compiler supports OSX deployment target flag - yes

-- Detecting Fortran compiler ABI info

-- Detecting Fortran compiler ABI info - done

-- Check for working Fortran compiler: /opt/homebrew/bin/gfortran - skipped

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working C compiler: /opt/local/libexec/llvm-15/bin/clang - 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: /opt/local/libexec/llvm-15/bin/clang++ - skipped

-- Detecting CXX compile features

-- Detecting CXX compile features - done

With SIMD_EXTENSIONS "none" tricubic interpolation of vector grids is not possible. You should set SIMD_EXTENSION to a compatible value ("avx", "avx+fma", or -- depending on the build CPU -- "native"). Trilinear interpolation is still possible.

-- Build Type: Release

-- CRPropa version: 3.2-no-git

CMake Deprecation Warning at libs/gtest/CMakeLists.txt:20 (cmake_minimum_required):

Compatibility with CMake < 2.8.12 will be removed from a future version of

CMake.

Update the VERSION argument value or use a ... suffix to tell

CMake that the project does not need compatibility with older versions.

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success

-- Found Threads: TRUE

CMake Deprecation Warning at libs/kiss/CMakeLists.txt:1 (cmake_minimum_required):

Compatibility with CMake < 2.8.12 will be removed from a future version of

CMake.

Update the VERSION argument value or use a ... suffix to tell

CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at libs/HepPID/CMakeLists.txt:1 (cmake_minimum_required):

Compatibility with CMake < 2.8.12 will be removed from a future version of

CMake.

Update the VERSION argument value or use a ... suffix to tell

CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at libs/sophia/CMakeLists.txt:1 (cmake_minimum_required):

Compatibility with CMake < 2.8.12 will be removed from a future version of

CMake.

Update the VERSION argument value or use a ... suffix to tell

CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at libs/dint/CMakeLists.txt:1 (cmake_minimum_required):

Compatibility with CMake < 2.8.12 will be removed from a future version of

CMake.

Update the VERSION argument value or use a ... suffix to tell

CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at libs/EleCa/CMakeLists.txt:1 (cmake_minimum_required):

Compatibility with CMake < 2.8.12 will be removed from a future version of

CMake.

Update the VERSION argument value or use a ... suffix to tell

CMake that the project does not need compatibility with older versions.

Using provided EIGEN

CMake Deprecation Warning at libs/healpix_base/CMakeLists.txt:1 (cmake_minimum_required):

Compatibility with CMake < 2.8.12 will be removed from a future version of

CMake.

Update the VERSION argument value or use a ... suffix to tell

CMake that the project does not need compatibility with older versions.

-- Found OpenMP_C: -fopenmp =libomp -I/opt/local/libexec/llvm-15/lib/clang/15.0.7/include

-- Found OpenMP_CXX: -fopenmp -I/opt/local/libexec/llvm-15/lib/clang/15.0.7/include (found version "5.0")

-- Found OpenMP_Fortran: -fopenmp (found version "4.5")

-- Found OpenMP: TRUE (found version "5.0")

-- Google perftools: Found!

-- Include: /opt/local/include

-- FFTW3 with single precision (FFTW3F): Found!

-- Include: /opt/homebrew/Cellar/fftw/3.3.10_1/include

-- Library: /opt/homebrew/Cellar/fftw/3.3.10_1/lib/libfftw3f.dylib

-- Quimby: NOT Found!

-- Include: QUIMBY_INCLUDE_DIR-NOTFOUND

-- Library: QUIMBY_LIBRARY-NOTFOUND

-- SAGA: NOT Found!

-- Include: SAGA_INCLUDE_DIR-NOTFOUND

-- Library: SAGA_LIBRARY-NOTFOUND

-- Found PkgConfig: /opt/local/bin/pkg-config (found version "0.29.2")

-- muParser: Found!

-- Include: /opt/local/include

-- Library: /opt/local/lib/libmuparser.dylib

-- Found ZLIB: /opt/local/lib/libz.dylib (found version "1.3.#define ZLIB_VERSION "1.3"")

-- Found HDF5: /opt/local/lib/libhdf5.dylib;/opt/local/lib/libaec/lib/libsz.dylib;/opt/local/lib/libz.dylib;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/lib/libdl.tbd;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/lib/libm.tbd (found version "1.14.2") found components: C

-- Downloading data file from crpropa.desy.de ~ 65 MB

-- Extracting data file

Error copying directory from "/Users/mariebenedova/Documents/BP/CRPropa3-3.2/build/data-2022-07-06/data" to "/Users/mariebenedova/Documents/BP/CRPropa3-3.2/build/data/".

-- Build of documentation disabeled. Enable with BUILD_DOC=On

-- Found PythonInterp: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 (found version "3.11.4")

-- Found PythonLibs: /Library/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib (found version "3.11.4")

-- Found SWIG: /Library/Frameworks/Python.framework/Versions/3.11/bin/swig (found suitable version "4.1.1", minimum required is "3.0")

-- Using user provided Python library: /Library/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib

-- Python: Found!

-- Version: 3.11/311

-- Executeable: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11

-- Include: /Library/Frameworks/Python.framework/Versions/3.11/include/python3.11

-- Library: /Library/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib

-- Site-package directory: lib/python3.11/site-packages

-- Found numpy headers in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/include

-- Configuring done

CMake Warning (dev) at libs/kiss/CMakeLists.txt:5 (add_library):

Policy CMP0115 is not set: Source file extensions must be explicit. Run

"cmake --help-policy CMP0115" for policy details. Use the cmake_policy

command to set the policy and suppress this warning.

File:

/Users/mariebenedova/Documents/BP/CRPropa3-3.2/libs/kiss/src/logger.cpp

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at libs/kiss/CMakeLists.txt:5 (add_library):

Policy CMP0115 is not set: Source file extensions must be explicit. Run

"cmake --help-policy CMP0115" for policy details. Use the cmake_policy

command to set the policy and suppress this warning.

File:

/Users/mariebenedova/Documents/BP/CRPropa3-3.2/libs/kiss/src/path.cpp

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at libs/kiss/CMakeLists.txt:5 (add_library):

Policy CMP0115 is not set: Source file extensions must be explicit. Run

"cmake --help-policy CMP0115" for policy details. Use the cmake_policy

command to set the policy and suppress this warning.

File:

/Users/mariebenedova/Documents/BP/CRPropa3-3.2/libs/kiss/src/string.cpp

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at libs/kiss/CMakeLists.txt:5 (add_library):

Policy CMP0115 is not set: Source file extensions must be explicit. Run

"cmake --help-policy CMP0115" for policy details. Use the cmake_policy

command to set the policy and suppress this warning.

File:

/Users/mariebenedova/Documents/BP/CRPropa3-3.2/libs/kiss/src/uuid.cpp

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at libs/EleCa/CMakeLists.txt:5 (add_library):

Policy CMP0115 is not set: Source file extensions must be explicit. Run

"cmake --help-policy CMP0115" for policy details. Use the cmake_policy

command to set the policy and suppress this warning.

File:

/Users/mariebenedova/Documents/BP/CRPropa3-3.2/libs/EleCa/src/Common.cpp

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at libs/EleCa/CMakeLists.txt:5 (add_library):

Policy CMP0115 is not set: Source file extensions must be explicit. Run

"cmake --help-policy CMP0115" for policy details. Use the cmake_policy

command to set the policy and suppress this warning.

File:

/Users/mariebenedova/Documents/BP/CRPropa3-3.2/libs/EleCa/src/EnergyLoss.cpp

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at libs/EleCa/CMakeLists.txt:5 (add_library):

Policy CMP0115 is not set: Source file extensions must be explicit. Run

"cmake --help-policy CMP0115" for policy details. Use the cmake_policy

command to set the policy and suppress this warning.

File:

/Users/mariebenedova/Documents/BP/CRPropa3-3.2/libs/EleCa/src/Particle.cpp

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at libs/EleCa/CMakeLists.txt:5 (add_library):

Policy CMP0115 is not set: Source file extensions must be explicit. Run

"cmake --help-policy CMP0115" for policy details. Use the cmake_policy

command to set the policy and suppress this warning.

File:

/Users/mariebenedova/Documents/BP/CRPropa3-3.2/libs/EleCa/src/Process.cpp

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at libs/EleCa/CMakeLists.txt:5 (add_library):

Policy CMP0115 is not set: Source file extensions must be explicit. Run

"cmake --help-policy CMP0115" for policy details. Use the cmake_policy

command to set the policy and suppress this warning.

File:

/Users/mariebenedova/Documents/BP/CRPropa3-3.2/libs/EleCa/src/Propagation.cpp

This warning is for project developers. Use -Wno-dev to suppress it.

-- Generating done

CMake Warning:

Manually-specified variables were not used by the project:

ENABLE_FFTW3F

-- Build files have been written to: /Users/mariebenedova/Documents/BP/CRPropa3-3.2/build `

rafaelab commented 7 months ago

You still seem to be using the other library (/opt/local/lib/libfftw3.dylib), without the f at the end. It should be libfftw3f.dylib. If you don't have libfftw3f.dylib, this should be installed and either exposed to the whole system or passed to cmake as you are currently doing.

AlenaBakalova commented 7 months ago

Do we? It says /opt/homebrew/Cellar/fftw/3.3.10_1/lib/libfftw3f.dylib where the FFTW3 is found. It previously wasnt installed but now we installed it using homebrew instead of macports and we found it there in the new location. I also updated the PATH and LD_LIBRARY_PATH so it checks the fftw installed in the homebrew directory. The new cmake command we are using is

cmake .. \ -DENABLE_GALACTICMAGNETICLENS=ON \ -DCMAKE_INSTALL_PREFIX=$CRPROPA_DIR \ -DPYTHON_EXECUTABLE=$PYTHON_DIR/bin/python$PYTHON_VERSION \ -DPYTHON_LIBRARY=$PYTHON_DIR/lib/libpython$PYTHON_VERSION.dylib \ -DPYTHON_INCLUDE_PATH=$PYTHON_DIR/include/python$PYTHON_VERSION \ -DCMAKE_C_COMPILER=$LLVM_DIR/bin/clang \ -DCMAKE_CXX_COMPILER=$LLVM_DIR/bin/clang++ \ -DOpenMP_CXX_FLAGS="-fopenmp -I$LLVM_DIR/lib/clang/$LLVM_VERSION/include" \ -DOpenMP_C_FLAGS="-fopenmp =libomp -I$LLVM_DIR/lib/clang/$LLVM_VERSION/include" \ -DOpenMP_libomp_LIBRARY=$LLVM_DIR/lib/libomp.dylib \ -DCMAKE_SHARED_LINKER_FLAGS="-L$LLVM_DIR/lib -lomp -Wl,-rpath,$LLVM_DIR/lib" \ -DOpenMP_C_LIB_NAMES=libomp \ -DOpenMP_CXX_LIB_NAMES=libomp \ -DNO_TCMALLOC=TRUE \ -DFFTW3F_LIBRARY=/opt/homebrew/Cellar/fftw/3.3.10_1/lib/libfftw3f.dylib \ -DFFTW3F_INCLUDE_DIR=/opt/homebrew/Cellar/fftw/3.3.10_1/include \ -DENABLE_FFTW3F=ON

rafaelab commented 7 months ago

Hi @AlenaBakalova Ah! I looked by mistake at your previous message. Now you did provide it. So I assume you are 100% sure the files /opt/homebrew/Cellar/fftw/3.3.10_1/lib/libfftw3f.dylib and fftw3.h in /opt/homebrew/Cellar/fftw/3.3.10_1/include exist, right? In this case, what is the problem? Did you test the installation?

The fact that you get

ENABLE_FFTW3F

doesn't mean anything because ENABLE_FFTW3F is not an existing flag. Only -DFFTW3F_LIBRARY and -DFFTW3F_INCLUDE_DIR are defined.

If the library and header files exist, and if there is no unwanted lingering cmake cache in your build folder, this feature should necessarily be working. Have you tried

from crpropa import *
print(initTurbulence)

to see if the function is available now?

AlenaBakalova commented 7 months ago

Oh I see. Previously it did not work, but this time we didnt try it since we saw that message again. Student already left for today but I will ask her to check it and let you know. Hopefully it will work now. Thank you very much!

AlenaBakalova commented 7 months ago

After finishing the installation and trying the print(initTurbulence) we got <built-in function initTurbulence> so it looks like its working now. Thank you again.