esmf-org / esmf

The Earth System Modeling Framework (ESMF) is a suite of software tools for developing high-performance, multi-component Earth science modeling applications.
https://earthsystemmodeling.org/
Other
149 stars 70 forks source link

Error building with gfortran on 32 bit ABI machine #254

Open danrosen25 opened 1 month ago

danrosen25 commented 1 month ago

Discussed in https://github.com/orgs/esmf-org/discussions/251

Originally posted by **GrigorisLionis** May 28, 2024 ### ESMF Version v.8.6.1. ### Issue I am trying to build latest stable version from source (a.k.a. 8.6.1.) I have encountered a problem compiling the sources, due to a type mismatch error The output of the error is as following: gfortran -c -fallow-argument-mismatch -fallow-invalid-boz -O -fPIC -pthread -ffree-line-length-none -fopenmp -I/home/user/esmf/esmf-8.6.1/src/Infrastructure/Util/src -I/home/user/esmf/esmf-8.6.1/build_config/Linux.gfortran.default -I/home/user/esmf/esmf-8.6.1/src/Infrastructure -I/home/user/esmf/esmf-8.6.1/src/Superstructure -I/home/user/esmf/esmf-8.6.1/mod/modO/Linux.gfortran.32.mpiuni.default -I/home/user/esmf/esmf-8.6.1/src/include -DESMF_NO_INTEGER_1_BYTE -DESMF_NO_INTEGER_2_BYTE -DESMF_MPIUNI -I/home/user/esmf/esmf-8.6.1/src/Infrastructure/stubs/mpiuni -DESMF_LOWERCASE_SINGLEUNDERSCORE -DESMF_MOAB=1 -DESMF_LAPACK=1 -DESMF_LAPACK_INTERNAL=1 -DESMF_NO_ACC_SOFTWARE_STACK=1 -DESMF_YAMLCPP=1 -DESMF_YAML=1 -DESMF_NO_OPENACC -DESMF_BOPT_O -DESMF_TESTCOMPTUNNEL -DS32=1 -DESMF_OS_Linux=1 -DESMF_COMM=mpiuni -DESMF_DIR=/home/user/esmf/esmf-8.6.1 /home/user/esmf/esmf-8.6.1/src/Infrastructure/Util/src/ESMF_FortranWordsize.F90 -o /home/user/esmf/esmf-8.6.1/obj/objO/Linux.gfortran.32.mpiuni.default/ESMF_FortranWordsize.o /home/user/esmf/esmf-8.6.1/src/Infrastructure/Util/src/ESMF_FortranWordsize.F90:425:77: 425 | call ESMF_PointerDifference(C_SIZEOF (c_ptrvar), varTK(1), varTK(2), wsize) | 1 Error: Type mismatch in argument ‘n’ at (1); passed INTEGER(4) to INTEGER(8) /home/user/esmf/esmf-8.6.1/src/Infrastructure/Util/src/ESMF_FortranWordsize.F90:380:77: 380 | call ESMF_PointerDifference(C_SIZEOF (c_ptrvar), varTK(1), varTK(2), wsize) | 1 Error: Type mismatch in argument ‘n’ at (1); passed INTEGER(4) to INTEGER(8) /home/user/esmf/esmf-8.6.1/src/Infrastructure/Util/src/ESMF_FortranWordsize.F90:335:77: 335 | call ESMF_PointerDifference(C_SIZEOF (c_ptrvar), varTK(1), varTK(2), wsize) | 1 Error: Type mismatch in argument ‘n’ at (1); passed INTEGER(4) to INTEGER(8) /home/user/esmf/esmf-8.6.1/src/Infrastructure/Util/src/ESMF_FortranWordsize.F90:290:77: 290 | call ESMF_PointerDifference(C_SIZEOF (c_ptrvar), varTK(1), varTK(2), wsize) | 1 Error: Type mismatch in argument ‘n’ at (1); passed INTEGER(4) to INTEGER(8) /home/user/esmf/esmf-8.6.1/src/Infrastructure/Util/src/ESMF_FortranWordsize.F90:113:79: 113 | call ESMF_PointerDifference(C_SIZEOF (c_ptrvar), udt_ptr1, udt_ptr2, psize) | 1 Error: Type mismatch in argument ‘n’ at (1); passed INTEGER(4) to INTEGER(8) /home/user/esmf/esmf-8.6.1/src/Infrastructure/Util/src/ESMF_FortranWordsize.F90:442:7: 442 | use ESMF_FortranWordsizeMod | 1 Fatal Error: Cannot open module file ‘esmf_fortranwordsizemod.mod’ for reading at (1): Δεν υπάρχει τέτοιο αρχείο ή κατάλογος compilation terminated. I have used a number of different fortran compilers with the same result.
theurich commented 1 month ago

@GrigorisLionis at your convenience please give https://github.com/esmf-org/esmf/tree/patch/8.6.2 a try on your 32-bit system. Let us know how it goes. Thanks!

theurich commented 1 month ago

@GrigorisLionis - I just pushed another set of changes to https://github.com/esmf-org/esmf/tree/patch/8.6.2. Please test under your 32-bit system at your convenience. Thank you!

GrigorisLionis commented 1 month ago

Στιγμιότυπο οθόνης_2024-06-05_13-07-51

This version compiles ok!!

make test resulted in some errors Στιγμιότυπο οθόνης_2024-06-05_13-48-08

I am sending you the results of the test Linux.gfortran.32.mpiuni.default.tar.gz

theurich commented 1 month ago

Well, we are making progress. Thank you for testing! Two requests: (1) Please set ESMF_BOPT=g in your build environment, (2) unset ESMF_F90COMPILEOPTS (to confirm it is no longer needed). Then rebuild from a fresh clone and run the tests. I hope we get more info in the back traces with debug enabled. Thanks.

GrigorisLionis commented 1 month ago

We sure are. Testing the least I can do! -compiled ok with seettings with fresh copy from git) make.info.txt -I am sending you all the results of the test testg.tar.gz

theurich commented 4 weeks ago

@GrigorisLionis - Thanks again. I looked over the more complete back traces from your debug run. It is going to be touch to figure out what exactly is causing those crashes especially not having a 32-bit environment myself. You might be better off using a 64-bit system after all for now. Alternatively you could try using this build in your ESMPy project and see if it holds up. A lot seems to function correctly, except something mostly around XGrid, which might not be an issue in your case. But of course it's a bit shaky not knowing exactly what those crashes are due.

@danrosen25 and @uturuncoglu - is it possible to set up a 32-bit runner for our own testing of ESMF? We probably need that anyway if we want to reliably support this build option again forward going.

danrosen25 commented 3 weeks ago

@theurich GitHub doesn't provide 32 bit runners. We can try to build a i386 image for Docker and emulate it through the Docker VM. I think you can force emulation with docker run --rm -it --platform linux/386 esmf/esmf-build-stack bash -l then we can maybe run this image through the GitHub actions to try to build ESMF.