Git Product home page Git Product logo

Comments (23)

platipodium avatar platipodium commented on August 16, 2024 1

OK, I got it.

❯ brew install -cc=gcc open-mpi
❯ cmake -S ../src  -DCMAKE_Fortran_COMPILER=/opt/homebrew/bin/mpifort -DBLD_STANDALONE=ON -DCMAKE_C_COMPILER=/opt/homebrew/bin/mpicc -DCMAKE_CXX_COMPILER=/opt/homebrew/bin/mpicxx
❯ make pschism

So we do have it working on gcc/gfortran toolchain, but still not clang/gfortran :=(

from schism.

platipodium avatar platipodium commented on August 16, 2024
make  -f Core/CMakeFiles/core.dir/build.make Core/CMakeFiles/core.dir/build
make[3]: Entering directory '/Users/Lemmen/devel/schism/schism/build'
/opt/conda/envs/schism/bin/cmake -E cmake_copy_f90_mod include/schism_glbl.mod Core/CMakeFiles/core.dir/schism_glbl.mod.stamp GNU
Error copying Fortran module "include/schism_glbl.mod".  Tried "include/SCHISM_GLBL.mod" and "include/schism_glbl.mod".
m

from schism.

jreniel avatar jreniel commented on August 16, 2024

Hi @platipodium,
I'm willing to take a shot at this problem.
This may sound like a silly question (you may have a reason) but this is so I can understand better your context.
Is there any reason why you are invoking
make -f Core/CMakeFiles/core.dir/build.make Core/CMakeFiles/core.dir/build
Instead of invoking something like this:

mkdir build
cd build
cmake ../src  # any other cmake opts here
make

from schism.

platipodium avatar platipodium commented on August 16, 2024

Thanks @jreniel. I did exactly that. The VERBOSE option of make then isolates the culprit line (within the regular make schism), which is

cmake -E cmake_copy_f90_mod include/schism_glbl.mod Core/CMakeFiles/core.dir/schism_glbl.mod.stamp GNU

Googling that, I saw a lot of reports on this with older cmake versions, but I am at 3.27 where this issue should be fixed.

Another idea was that it might be related to erroneous preprocessing options (which is poorly handled by cmake in mixed gfortran-clang environments, but following up some stack overflow ideas on PREPROCESS_OPTIONS didn't help. I also tried the -J and -M options to place mod files, but to no avail.

from schism.

platipodium avatar platipodium commented on August 16, 2024

To reproduce, this is my conda configuration

conda install gfortran clang mpi netcdf-fortran parmetis

from schism.

jreniel avatar jreniel commented on August 16, 2024

Thanks for the clarification, I'll try to reproduce the problem and let you know what I find soon.

from schism.

jreniel avatar jreniel commented on August 16, 2024

Could you please share the cmake flags you are using to configure cmake?
After installing the dependencies you specified (by adding -c conda-forge), and running cmake ../src without any configuration flags, I noticed that cmake is able to pick up by default the clang compiler. Then CMake tries to build the parmetis on the SCHISM directory (rather than using the one installed through conda) using clang. However it tries to add some flags that clang compiler does not recognize and fails. So knowing which configuration flags you were applying to cmake would be helpful.

Additionally, I have a 2016 Mac, but it doesn't have an M1 processor, so I might not be able to replicate the error. However, I would argue that given the correct configuration and environment it should compile. Then again, if I'm not mistaken, the M1 processors are ARM processors and I have never seen SCHISM being compiled on ARM architechture.

Compiler problems are always fun to debug, but more importantly, I'd like to see this compiled on ARM architechture, that would be cool.

from schism.

platipodium avatar platipodium commented on August 16, 2024

Oh.. it's been working on Mac M1 for at least a year. On my local laptop through macports. But I have now switched to a conda toolchain.

Here's my CMAKE command:

cmake -S ../src  -DCMAKE_Fortran_COMPILER=${CONDA_PREFIX}/bin/mpifort -DCMAKE_C_COMPILER=${CONDA_PREFIX}/bin/mpicc -DPARMETIS_HOME=${CONDA_PREFIX}

Can you reproduce the error (on linux/conda or Mac/conda)?

from schism.

platipodium avatar platipodium commented on August 16, 2024

Just a side note, M1/arm64/gfortran toolchain via macports continues to work:

$> cat ../cmake/SCHISM.local.macports

set(CMAKE_Fortran_COMPILER /opt/local/bin/gfortran CACHE PATH "Path to serial Fortran compiler")
set(CMAKE_C_COMPILER /opt/local/bin/gcc CACHE PATH "Path to serial C compiler")
set(NetCDF_FORTRAN_DIR /opt/local  CACHE PATH "Path to NetCDF Fortran library")
set(NetCDF_C_DIR /opt/local CACHE PATH "Path to NetCDF C library")

from schism.

platipodium avatar platipodium commented on August 16, 2024

The major difference is that there is gfortran/gcc (macports) versus gfortran/clang (conda). And the mix of fortran/c with cmake has been having issues with PREPROCESS_FLAGS (--preprocess versus -cpp) ... but how to connect this to the above error I am not sure. Neither how to fix :=)

from schism.

jreniel avatar jreniel commented on August 16, 2024

Thanks for adding more context to the problem statement, that does help rule out some possibilities and hone in on potential solutions.

from schism.

brey avatar brey commented on August 16, 2024

Hi All. Just to say that I have the same problem on my (old) Mac trying to compile the latest version of SCHISM. I am also using conda.

from schism.

platipodium avatar platipodium commented on August 16, 2024

Error persists. An update to my previous command for reproducing this is the STANDALONE cmake flag that is now necessary

conda install gfortran clang mpi netcdf-fortran parmetis
cmake -S ../src  -DCMAKE_Fortran_COMPILER=${CONDA_PREFIX}/bin/mpifort -DCMAKE_C_COMPILER=${CONDA_PREFIX}/bin/mpicc -DPARMETIS_HOME=${CONDA_PREFIX} -DBLD_STANDALONE=ON
make schism

from schism.

fred116 avatar fred116 commented on August 16, 2024

Hi, I am novice here, but have a fairly clean M2 system and am actively working on this (since I need to use it :)), so I can test configs as long as I get reasonable instructions.

I am running macOS 14, but no Conda. I installed the pre-reqs via home-brew, fortran, mai, NetCDF-fortran. I was using gcc/clang from apple as default, and went through the make options in the documentation. I was about to install a home-brew gcc (12) and switch to trying the older make.

any suggestions?

from schism.

platipodium avatar platipodium commented on August 16, 2024

Hi, I am novice here, but have a fairly clean M2 system and am actively working on this (since I need to use it :)),

Help is greatly appreciated. Most important advise: keep your system clean and document / be able to retrace your steps. Both homebrew and conda install mixed gfortran/clang environments that seem to create difficulties; macports has both gfortran/gcc and gfortran/clang available. Please report how you fare ...

from schism.

fred116 avatar fred116 commented on August 16, 2024

I think I further along, but not sure. I have switched to attempting the make build instead of cmake.

I got past the include/schism_glbl.mod error, but now get a series of these:

Core/schism_msgp.F90:1669:19:

1669 | call mpi_irecv(iegsend_2t(1,i),nesend_2t(i),itype,nbrrank_2t(i),16,comm,rrqst(i),ierr)
| 1
......
4095 | call mpi_irecv(e3d_2t_data,1,e3d_2t_tr_recv_type(i),nbrrank_2t(i),18,comm,e3d_2t_tr_recv_rqst(i),ierr)
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(8)).

If these are no longer related to this thread I will search somewhere else, or post to the mailing list. Thanks!

from schism.

platipodium avatar platipodium commented on August 16, 2024

@fred116 this has been discussed elsewhere and is a consequence of your direct use of make instead of cmake and mpich upstream problems. You need to provide -fallow-argument-mismatch to proceed.

See #18

from schism.

fred116 avatar fred116 commented on August 16, 2024

Just $0.02 here -- I finally got what I think is a successful build on Sonoma/M2.

I installed:
gfortran
gcc-13
netcdf/netcdf-fortran/netcdf-cxx
open-mai

via homebrew. In my SCHISM.local.myown I included gcc-13

I then followed the cmake instructions; then 'make pschism'

resulting binary gave me:

epictetus:bin gbsmith$ sudo ./pschism_mac_epictetus_TVD-VL -v

schism v5.11.1
git hash e2bf5bd
epictetus:bin gbsmith$

from schism.

platipodium avatar platipodium commented on August 16, 2024

@fred116 How did you achieve mpich to use gcc? For me brew continues to use clang:

❯ which mpicc && mpicc --version
/opt/homebrew/bin/mpicc
clang version 16.0.6

... and then run into the mixed gfortran/clang trap. Please check which mpich you're using, and post your SCHISM.local.myown

from schism.

platipodium avatar platipodium commented on August 16, 2024

epictetus:bin gbsmith$ sudo ./pschism_mac_epictetus_TVD-VL -v

@fred116 you should not have to run pschism with sudo. On the other hand, you show how much you trust us :=)

from schism.

fred116 avatar fred116 commented on August 16, 2024

from schism.

fred116 avatar fred116 commented on August 16, 2024

from schism.

platipodium avatar platipodium commented on August 16, 2024

Post your SCHISM.local.myown

I added the homebrew cmake recipe as ./cmake/SCHISM.homebrew.gcc-openmpi with commit fefb7aa, use with

cmake ../src -C ../cmake/SCHISM.homebrew.gcc-openmpi

from schism.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.