Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MILLEPEDE: Allow pede to compile on macos (m2) #5588

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

f3sch
Copy link

@f3sch f3sch commented Aug 21, 2024

On macOS fortran files need to be compiled with gfortran, this MR overrides the compiler set by the Millepede Makefile from gcc to gfortran, which then works correctly.

I am not sure if dropping the requirement in case of osx is the right way to go, while I have libomp installed the check in openmp.sh does not pick it up correctly.
Maybe one can also to do something like this:

@@ -6,5 +6,13 @@ system_requirement_missing: |
     * On Linux it comes with the compiler
 system_requirement: ".*"
 system_requirement_check: |
-  printf "#include <omp.h>\n" | cc -xc - -fopenmp -c -o /dev/null
+  set -e
+  case ${ALIBUILD_ARCHITECTURE} in
+    osx*)
+      printf "#include <omp.h>\n" | cc -Xpreprocessor -fopenmp -lomp -I"$(brew --prefix libomp)/include" -L"$(brew --prefix libomp)/lib" -c -o /dev/null
+      ;;
+    *)
+      printf "#include <omp.h>\n" | cc -xc - -fopenmp -c -o /dev/null
+      ;;
+  esac
 ---

I do not know the impact of this change on the macOS builds. But from #1922 I inferred that the openmp check was added for macOS builds since the linux compilers ship with it. But looking at o2 this is not a requirement of o2.sh, but of openblas (only a requirement for millepede) and somehow an implicit requirement of upcgen.sh with -DBUILD_WITH_OPENMP=ON. I checked on a linux machine and macOS, it appears to do what I want. But I do not know if this is the correct way to do it.

Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
@f3sch f3sch requested a review from a team as a code owner August 21, 2024 07:55
@@ -16,13 +18,17 @@ rsync -av --delete --exclude="**/.git" ${SOURCEDIR}/ .

case $ARCHITECTURE in
osx*)
[[ ! $ZLIB_ROOT ]] && ZLIB_ROOT=`brew --prefix zlib` ;;
[[ ! $ZLIB_ROOT ]] && ZLIB_ROOT=$(brew --prefix zlib)
[[ ! $GFORTRAN ]] && GFORTRAN=gfortran
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is supposed to set this variable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably nothing from the outside, I just kept the same code as for other variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants