MPAS-Dev / MPAS-Model

Repository for MPAS models and shared framework releases.
237 stars 317 forks source link

PIO check fail during compilation of MPAS 7.0 #390

Closed srafkin closed 4 years ago

srafkin commented 4 years ago

The MPAS 7.0 compilation fails during the pio check. I've edited the Makefile so the output is sent to standard output rather than /dev/null. Result is below along with additional info. Looks like a pathname problem related to a mystery MPAS include file (maybe?), but I've been unable to hunt it down. Thanks in advance for any help.

-bash-4.2$ make gfortran ( make all \ "FC_PARALLEL = mpif90" \ "CC_PARALLEL = mpicc" \ "CXX_PARALLEL = mpicxx" \ "FC_SERIAL = gfortran" \ "CC_SERIAL = gcc" \ "CXX_SERIAL = g++" \ "FFLAGS_PROMOTION = -fdefault-real-8 -fdefault-double-8" \ "FFLAGS_OPT = -O3 -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form" \ "CFLAGS_OPT = -O3 -m64" \ "CXXFLAGS_OPT = -O3 -m64" \ "LDFLAGS_OPT = -O3 -m64" \ "FFLAGS_DEBUG = -g -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow" \ "CFLAGS_DEBUG = -g -m64" \ "CXXFLAGS_DEBUG = -O3 -m64" \ "LDFLAGS_DEBUG = -g -m64" \ "FFLAGS_OMP = -fopenmp" \ "CFLAGS_OMP = -fopenmp" \ "CORE = atmosphere" \ "DEBUG = " \ "USE_PAPI = " \ "OPENMP = " \ "CPPFLAGS = -D_MPI" ) make[1]: Entering directory `/home/rafkin/MPAS-Model' Checking for a usable PIO library... pio1.f90:1:137:

program pio1; use pio; use pionfatt_mod; integer, parameter :: MPAS_IO_OFFSET_KIND = PIO_OFFSET; integer, parameter :: MPAS_INT_FILLVAL = NF_FILL_INT; end program 1 Error: Parameter 'nf_fill_int' at (1) has not been declared or is a variable, which does not reduce to a constant expression pio2.f90:1:66:

program pio2; use pio; integer, parameter :: MPAS_IO_OFFSET_KIND = PIO_OFFSET_KIND; integer, parameter :: MPAS_INT_FILLVAL = PIO_FILL_INT; end program 1 Error: Parameter 'pio_offset_kind' at (1) has not been declared or is a variable, which does not reduce to a constant expression pio2.f90:1:124:

program pio2; use pio; integer, parameter :: MPAS_IO_OFFSET_KIND = PIO_OFFSET_KIND; integer, parameter :: MPAS_INT_FILLVAL = PIO_FILL_INT; end program 1 Error: Parameter 'pio_fill_int' at (1) has not been declared or is a variable, which does not reduce to a constant expression **** ERROR **** Failed to compile a PIO test program Please ensure the PIO environment variable is set to the PIO installation directory **** ERROR **** make[1]: [pio_test] Error 1 make[1]: Leaving directory `/home/rafkin/MPAS-Model' make: [gfortran] Error 2

I'm on CentOS7 using gfortran 5.5.0_4 with mpich 3.3.1, NetCDF 4.6.3_1, PNetCDF 1.7.0_2, and pio 1.7.2.

-bash-4.2$ echo $CORE $NETCDF $PNETCDF $PIO atmosphere /home/linuxbrew/.linuxbrew/Cellar/netcdf/4.6.3_1 /home/linuxbrew/.linuxbrew/Cellar/parallel-netcdf/1.7.0_2 /home/linuxbrew/.linuxbrew/Cellar/pio/1.7.2

bash-4.2$ uname -a Linux mpas.boulder.swri.edu 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

mgduda commented 4 years ago

@srafkin Until we've determined unambiguously that there is a bug in the code, could you post this issue to the MPAS-Atmosphere support forum at http://forum.mmm.ucar.edu/ ? The forum is better suited to requests for assistance, while GitHub Issues may be better for tracking bugs to be fixed in the code.

srafkin commented 4 years ago

Hi Michael,

Will do.  Thanks!

Scot

On 11/7/2019 10:57 AM, Michael Duda wrote:

@srafkin https://github.com/srafkin Until we've determined unambiguously that there is a bug in the code, could you post this issue to the MPAS-Atmosphere support forum at http://forum.mmm.ucar.edu/ ? The forum is better suited to requests for assistance, while GitHub Issues may be better for tracking bugs to be fixed in the code.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MPAS-Dev/MPAS-Model/issues/390?email_source=notifications&email_token=ANWUHNZ52SHC6M4VQQSS5R3QSRJJDA5CNFSM4JKHG4DKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDNITGA#issuecomment-551192984, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANWUHN2B5QXZBWPAPXHU3Z3QSRJJDANCNFSM4JKHG4DA.

-- /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ Scot C. R. Rafkin, Ph.D. Program Director Southwest Research Institute, Department of Space Studies 1050 Walnut Street, Suite 300 Boulder, CO 80302 (720)240-0116 (office) (303)880-6227 (mobile) http://www.boulder.swri.edu/~rafkin rafkin.swri@gmail.com /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

mgduda commented 4 years ago

Because this is more likely (IMHO) to be a library installation issue than a bug in the Makefile, I'll close this issue for now; but, we can re-open it if it turns out that the Makefile needs to be modified.

cponder commented 2 years ago

@srafkin Did you ever resolve this? When I build MPAS-A as follows

make pgi CORE=atmosphere PRECISION=single PIO=/usr/local USE_PIO2=true OPENACC=true 'LDFLAGS_OPT=-O3 -Mcuda -L/usr/local/cuda-11.4/lib64'

I see these messages in my MPAS-A builds (from the 7.* develop branch)

Checking for a usable PIO library...
=> PIO 1 detected

What's perverse about this is that I'm building using the USE_PIO2=true build-option, so it shouldn't be looking for pio1 in the first place. My PIO build passes all of its regression-tests, so I believe that I built it correctly.

mgduda commented 2 years ago

@cponder Can you confirm that you've tried with either the v7.1 release (currently at the HEAD of the master branch) or the current HEAD of the develop branch? There was a fix in PR #914 that went in to the v7.1 release, though the failure that was addressed by that PR looks different from what you're reporting.

mgduda commented 2 years ago

For reference, this issue was discussed on the WRF/MPAS-A forum in this thread: https://forum.mmm.ucar.edu/phpBB3/viewtopic.php?f=10&t=8613 .

srafkin commented 2 years ago

Looks like Michael Duda is on the case.  I'm rather certain he can help better than I.  But, to answer the question, yes, I did manage to get it to work by using the script and packages at https://www2.mmm.ucar.edu/people/duda/files/mpas/sources.   Those packages may be obsolete by now, but they did work at the time.  The take away message that I learned was that you need to have fully compatible packages all compiled with the correct option flags.  If you do all that, and swing a 7-legged octopus (raw, not cooked) over your head, and click your heels together three times, the model will compile and run.  It's a real challenge.  

Good luck!

On 10/5/2021 3:30 PM, Carl Ponder wrote:

@srafkin https://github.com/srafkin Did you ever resolve this? I see these messages in my MPAS-A builds (from the 7.* |develop| branch)

|Checking for a usable PIO library... => PIO 1 detected NVFORTRAN-F-0002-Unable to open source input file: pio1.f90 NVFORTRAN/x86-64 Linux 21.9-0: compilation aborted NVFORTRAN-F-0002-Unable to open source input file: pio2.f90 NVFORTRAN/x86-64 Linux 21.9-0: compilation aborted |

What's perverse about this is that I'm building using the |USE_PIO2=true| build-option, so it shouldn't be looking for |pio1| in the first place. My PIO build passes all of its regression-tests, so I believe that I built it correctly. I'm setting this path in the environment prior to the build

|export PIO=/usr/local |

On the other hand, if I put this on the invocation-line

|make pgi CORE=atmosphere PRECISION=si ngle PIO=/usr/local USE_PIO2=true OPENACC=true 'LDFLAGS_OPT=-O3 -Mcuda -L/usr/local/cuda-11.4/lib64' |

I see the output

|Checking for a usable PIO library... => PIO 1 detected |

which is a lie, I didn't build PIO 1.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MPAS-Dev/MPAS-Model/issues/390#issuecomment-934873828, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANWUHN6RKVFASOZ3TEDBSJDUFNU53ANCNFSM4JKHG4DA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ Scot C. R. Rafkin, Ph.D. Program Director Southwest Research Institute, Department of Space Studies 1050 Walnut Street, Suite 300 Boulder, CO 80302 (720)240-0116 (office) (303)880-6227 (mobile) http://www.boulder.swri.edu/~rafkin @.*** /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

cponder commented 2 years ago

Yeah, the message is still there with 7.1:

Checking for a usable PIO library...
=> PIO 1 detected

I need to emphasize that the MPAS-A builds & runs ok. But I believe there's something wrong with the detection step here.

mgduda commented 2 years ago

@cponder Could you try compiling with the v7.1_debug_pio_detection branch from my fork and posting the stdout/stderr log here? I've modified the top-level Makefile in that branch to echo all of the commands that are being run when testing the PIO version.

cponder commented 2 years ago

Here's the debug output:

make[1]: Entering directory '/workdir/Source'
Checking for a usable PIO library...
(mpif90 pio1.f90  -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -O3 -byteswapio -Mfree -O3 -L/usr/local/lib -lpiof -lpioc -L/usr/local/lib -lnetcdff -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lpnetcdf -o pio1.out &> /dev/null && echo "=> PIO 1 detected") || \
(mpif90 pio2.f90  -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -O3 -byteswapio -Mfree -O3 -L/usr/local/lib -lpiof -lpioc -L/usr/local/lib -lnetcdff -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lpnetcdf -o pio2.out &> /dev/null && echo "=> PIO 2 detected") || \
(echo "************ ERROR ************"; \
 echo "Failed to compile a PIO test program"; \
 echo "Please ensure the PIO environment variable is set to the PIO installation directory"; \
 echo "************ ERROR ************"; \
 exit 1)
=> PIO 1 detected
(mpif90 pio2.f90  -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -O3 -byteswapio -Mfree -O3 -L/usr/local/lib -lpiof -lpioc -L/usr/local/lib -lnetcdff -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lpnetcdf -o pio2.out &> /dev/null) || \
(echo "************ ERROR ************"; \
 echo "PIO 1 was detected, but USE_PIO2=true was specified in the make command"; \
 echo "************ ERROR ************"; \
 exit 1)
mgduda commented 2 years ago

Thanks for giving that a try. I think it would be helpful now to see whether the pio2.f90 test program would have successfully compiled, and whether there were any messages printed during the compilation of the pio1.f90 test program. Could you try both of the following commands directly on the command-line:

mpif90 pio1.f90  -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -O3 -byteswapio -Mfree -O3 -L/usr/local/lib -lpiof -lpioc -L/usr/local/lib -lnetcdff -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lpnetcdf -o pio1.out

and

mpif90 pio2.f90  -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -O3 -byteswapio -Mfree -O3 -L/usr/local/lib -lpiof -lpioc -L/usr/local/lib -lnetcdff -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lpnetcdf -o pio2.out

The pio.f90 and pio2.f90 test programs should still be in your MPAS-Model directory, since the Makefile was modified to leave these in place.

Also, which compiler are you using, specifically, and which version of PIO have you installed?

cponder commented 2 years ago

Ok good -- here's what I have from the first command:

mpif90 pio1.f90  -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -O3 -byteswapio -Mfree -O3 -L/usr/local/lib -lpiof -lpioc -L/usr/local/lib -lnetcdff -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lpnetcdf -o pio1.out
mpif90 pio1.f90  -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -O3 -byteswapio -Mfree -O3 -L/usr/local/lib -lpiof -lpioc -L/usr/local/lib -lnetcdff -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lpnetcdf -o pio1.out
NVFORTRAN-S-0087-Non-constant expression where constant expression required (pio1.f90: 1)
NVFORTRAN-S-0087-Non-constant expression where constant expression required (pio1.f90: 1)
  0 inform,   0 warnings,   2 severes, 0 fatal for pio1

I took the liberty of splitting the one line in the file into separate lines

     1  program pio1
     2      use pio
     3      use pionfatt_mod
     4      integer, parameter :: MPAS_IO_OFFSET_KIND = PIO_OFFSET
     5      integer, parameter :: MPAS_INT_FILLVAL = NF_FILL_INT
     6  end program

in which case the error-messages change to

NVFORTRAN-S-0087-Non-constant expression where constant expression required (pio1.mod.f90: 4)
NVFORTRAN-S-0087-Non-constant expression where constant expression required (pio1.mod.f90: 5)

I'm guessing that PIO_OFFSET & NF_FILL_INT are not defined in PIO 2 so the compiler is expecting these to be variables.

cponder commented 2 years ago

The second case works just fine:

mpif90 pio2.f90  -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -O3 -byteswapio -Mfree -O3 -L/usr/local/lib -lpiof -lpioc -L/usr/local/lib -lnetcdff -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lpnetcdf -o pio2.out

which is why it's perverse that it reports that it found PIO 1 and not PIO 2.

I'm using the PGI 21.9 compiler with PIO version 2_5_4.

cponder commented 2 years ago

One thing I might suggest is testing for PIO 2 before PIO 1; I've had so many problems with PIO that I don't think anyone should be using anything but the latest. It's a moot point with earlier versions of MPAS-A, since we wouldn't be fixing the configuror for them anyway.