Build with gfortran + Open MPI on macOS (incl. Apple Silicon) and Linux, no MKL - #53
Open
neuromechanist wants to merge 2 commits into
Open
Build with gfortran + Open MPI on macOS (incl. Apple Silicon) and Linux, no MKL#53neuromechanist wants to merge 2 commits into
neuromechanist wants to merge 2 commits into
Conversation
Lets amica15 build with plain gfortran + Open MPI + LAPACK, no Intel/MKL or AMD LibM, on Apple Silicon and Linux. Addresses the M1 compile errors in sccn#44. - Portable random_seed: fill the compiler-defined full-size seed array (the fixed size-2 array only compiled with ifort). - vmath_shim.c: supply vrda_exp/vrda_log (non-MKL vectorized exp/log) as libm loops, so no vendor math library is needed. - build_gfortran.sh: -cpp (skip the MKL include), -std=legacy, per-platform LAPACK; single-rank Open MPI, OMP_NUM_THREADS for threads. - README: Compilation section; ship amica15_macos_arm64 (native Apple Silicon).
Member
Author
|
Removed the random_seed source change here (509c8be); that is now owned by #54, which does the same portable random_seed(SIZE=...) fix plus a reproducible seed param. This PR is now the gfortran / no-MKL build tooling only (build_gfortran.sh, vmath_shim.c, README, arm64 binary). Since the seed change is gone from here, building with gfortran needs #54's portable random_seed in the source first, so #54 should merge before this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the M1 compile errors reported in #44 and gives a vendor-neutral build path (also relevant to #49's Ubuntu question).
amica15.f90targets Intel's toolchain (ifort+ MKL), so a plaingfortran+ Open MPI + LAPACK build hits three issues; this PR resolves all three and adds a one-command build script + docs.Changes
random_seed(amica15.f90,amica15_header.f90). The source passed a fixed size-2 seed array, which onlyifortaccepts; gfortran requires an array of its own (larger) size. Now it queriesrandom_seed(SIZE=...)and fills the full-size array from the clock/rank/seed, so per-rank streams still differ. This was the root of several of the "no IMPLICIT type"/compile failures once the earlier errors are cleared.vmath_shim.csuppliesvrda_exp/vrda_log(the non-MKL branch's vectorized exp/log, otherwise from AMD LibM) aslibmloops, matching gfortran's by-reference/trailing-underscore ABI. No vendor math library (MKL VML or AMD LibM) is needed; results are IEEE-accurate.build_gfortran.shcompiles with the flags this Intel-oriented source needs under gfortran:-cpp(resolve#ifdef MKLso themkl_vml.f90include is skipped),-std=legacy -fallow-argument-mismatch(obsolescent constructs),-ffree-line-length-none, and per-platform LAPACK (Homebrewlapack/Accelerate on macOS,-llapack -lblason Linux). Runs as a single Open MPI rank (nompirun); threads viaOMP_NUM_THREADS.amica15_macos_arm64, a native Apple-Silicon binary (links Homebrew Open MPI + LAPACK, so running it needsbrew install gcc open-mpi lapack).Verified
Builds and runs on macOS arm64 (gfortran 16, Homebrew Open MPI + LAPACK) and Ubuntu 24.04 x86_64 (gfortran 13, apt Open MPI + liblapack-dev). A short fit on real sample EEG converges normally (LL ~ -3.46 at iter 5), matching the Intel build's trajectory.
Toolchain:
brew install gcc open-mpi lapacksudo apt-get install -y gfortran libopenmpi-dev openmpi-bin liblapack-dev libblas-dev