E3SM-Project / scorpio

A high-level Parallel I/O Library for structured grid applications
18 stars 16 forks source link

Compile scorpio with adios2, got error on PIO_MAX_CACHED_STEPS_FOR_ADIOS #554

Open halehawk opened 6 months ago

halehawk commented 6 months ago

Hello,

I tried to compile scorpio with adios2 at derecho.ucar.edu, I got the following error: /glade/derecho/scratch/haiyingx/scorpio/src/clib/pioc_support.c:360:58: error: expected expression file->max_step_calls = PIO_MAX_CACHED_STEPS_FOR_ADIOS;

It looks like PIO_MAX_CACHED_STEPS_FOR_ADIOS is set by during cmake as the follows, do I miss anything in the cmake options?

Thanks, Haiying

Here is the partial cmake log: CC=mpicc CXX=mpicxx FC=mpif90 cmake -DNetCDF_C_PATH=/glade/u/apps/derecho/23.06/spack/opt/spack/netcdf/4.9.2/cray-mpich/8.1.25/oneapi/2023.0.0/wzol/ \ -DNetCDF_Fortran_PATH=/glade/u/apps/derecho/23.06/spack/opt/spack/netcdf/4.9.2/cray-mpich/8.1.25/oneapi/2023.0.0/wzol/ \ -DPnetCDF_PATH=/glade/u/apps/derecho/23.06/spack/opt/spack/parallel-netcdf/1.12.3/cray-mpich/8.1.25/oneapi/2023.0.0/blyr/ \ -DWITH_ADIOS2=ON -DADIOS2_DIR=/glade/work/haiyingx/ADIOS2/installintelde/lib64/cmake/adios2 \ -DCMAKE_INSTALL_PREFIX=/glade/derecho/scratch/haiyingx/scorpio/install \ -DPIO_ENABLE_TESTS=ON \ ..

-- ===== Configuring SCORPIO... ===== -- Enabling SCORPIO I/O performance statistics collection (default) -- Using BGET to allocate memory for caching data in SCORPIO -- Disabling debug logging in SCORPIO (default) -- Disabling use/check of the MPI serial library (default) -- Disabling saving I/O decompositions (default) -- No limit on the number of cached I/O regions (default) -- Limit on the number of Lustre OSTs, PIO_MAX_LUSTRE_OSTS, is not set (default) -- Filesystem striping unit is not set (default) -- Using PnetCDF independent data mode to read variables in SCORPIO (default) -- Reserving some extra space in the header when creating NetCDF files, requested bytes = 10240 (default) -- Setting the maximum number of I/O decompositions registered with ADIOS type to PIO_MAX_ADIOS_DECOMPS = 65536 (default) -- Setting the maximum number of cached application steps for ADIOS type to PIO_MAX_CACHED_STEPS_FOR_ADIOS = 128 (default) -- Disabling code coverage... (use -DPIO_ENABLE_COVERAGE:BOOL=ON to enable coverage, only GNU is supported for now)

jayeshkrishna commented 6 months ago

Can you include your complete configure/make log (you can copy it in a github gist and include the link to gist here)?

halehawk commented 6 months ago

I found this error caused by the previously compiled libgptl.a of scorpio is reused. So this problem is gone, but after the successful compilation, I got a lot of fails on ctest. So I still share the cmake log here and ctest log. Could you please tell me how I can pass all ctest? Thanks! https://gist.github.com/halehawk/1acad191f06c3d805edf2a6cf9e020b2 LastTest.log

jayeshkrishna commented 6 months ago

Can you try launching one of the tests in a batch file (without using ctest, directly using mpiexec/aprun etc)?

It looks like ctest support for this machine (derecho?) is not added in SCORPIO yet. It should be a small patch that we can provide to you for testing that should get the ctest testing working for you. Please try running the tests manually in a batch file and let us know the results (Also include the batch file in the issue).

halehawk commented 6 months ago

I requested an interactive node on derecho, ran the ctest and single test as well. Some tests can pass now, but more cannot and even stuck at test #71. LastTest_0103.log

dqwu commented 6 months ago

@halehawk Your ADIOS2 lib is quite old (version 2.7.1) -- Found ADIOS2: /glade/work/haiyingx/ADIOS2/installintelde/lib64/cmake/adios2/adios2-config.cmake (found suitable version "2.7.1.745", minimum required is "2.7.0") found components: C CXX Fortran MPI

For latest ADIOS read support we do require ADIOS2 2.9.0 or higher versions. I think you can install ADIOS2 2.9.1 for testing (we have not tested latest 2.9.2 or 2.10.0-rc1 so far).

FYI, you can install ADIOS2 2.9.1 with the commands below (please change /path/to/your/adios/installation accordingly)

wget https://github.com/ornladios/ADIOS2/archive/refs/tags/v2.9.1.tar.gz
tar zxf v2.9.1.tar.gz

cd ADIOS2-2.9.1

mkdir build
cd build

CC=mpicc CXX=mpicxx FC=mpif90 \
CFLAGS="-g -O2" CPPFLAGS="-g -O2" CXXFLAGS="-g -O2" FCFLAGS="-g -O2" \
cmake \
-DCMAKE_INSTALL_PREFIX=/path/to/your/adios/installation \
-DBUILD_SHARED_LIBS=OFF -DADIOS2_BUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF \
-DADIOS2_USE_Blosc2=OFF \
-DADIOS2_USE_BZip2=OFF \
-DADIOS2_USE_ZFP=OFF \
-DADIOS2_USE_SZ=OFF \
-DADIOS2_USE_MGARD=OFF \
-DADIOS2_USE_PNG=OFF \
-DADIOS2_USE_DataMan=OFF \
-DADIOS2_USE_DataSpaces=OFF \
-DADIOS2_USE_MHS=OFF \
-DADIOS2_USE_ZeroMQ=OFF \
-DADIOS2_USE_HDF5=OFF \
-DADIOS2_USE_Python=OFF \
-DADIOS2_USE_Fortran=OFF \
-DADIOS2_USE_Profiling=OFF \
..

make -j4

make install
dqwu commented 6 months ago

@halehawk It seems that you configured SCORPIO with NetCDF 4.9.2: -- Checking NetCDF version - 4.9.2./*!<

Our nightly builds use an older but more stable NetCDF 4.8.0 lib for testing (higher versions have some known issues for the unit tests). In fact, you do not need NetCDF lib for testing ADIOS type (PnetCDF lib is sufficient).

FYI, you can use "-DWITH_NETCDF=OFF" to configure SCORPIO without NetCDF support (you can safely remove -DNetCDF_C_PATH=XXXX and -DNetCDF_Fortran_PATH=XXXX in this case).

dqwu commented 6 months ago

@halehawk As a sanity check on that machine, I would suggest that you first run the full SCORPIO unit tests with PnetCDF type only (SCORPIO is configured without NetCDF or ADIOS support):

git clone https://github.com/E3SM-Project/scorpio.git
cd scorpio

mkdir build
cd build

CC=mpicc CXX=mpicxx FC=mpif90 cmake -Wno-dev \
-DWITH_NETCDF=OFF \
-DPnetCDF_PATH=/glade/u/apps/derecho/23.06/spack/opt/spack/parallel-netcdf/1.12.3/cray-mpich/8.1.25/oneapi/2023.0.0/blyr \
-DPIO_USE_MALLOC=ON \
-DPIO_ENABLE_TESTS=ON \
-DPIO_ENABLE_EXAMPLES=ON \
..

make -j4

make tests

ctest

PIO_ENABLE_EXAMPLES is set to ON to enable testing some C examples. PIO_USE_MALLOC is set to ON (recommended) to use native malloc (instead of bget package).

halehawk commented 6 months ago

Sure, I will try your last suggestion first.Sent from my iPhoneOn Jan 4, 2024, at 9:24 AM, dqwu @.***> wrote: @halehawk As a sanity check, I would suggest that you run the full SCORPIO unit tests with PnetCDF type only (SCORPIO is configured without NetCDF or ADIOS support): git clone https://github.com/E3SM-Project/scorpio.git cd scorpio

mkdir build cd build

CC=mpicc CXX=mpicxx FC=mpif90 cmake -Wno-dev \ -DWITH_NETCDF=OFF \ -DPnetCDF_PATH=/glade/u/apps/derecho/23.06/spack/opt/spack/parallel-netcdf/1.12.3/cray-mpich/8.1.25/oneapi/2023.0.0/blyr \ -DPIO_USE_MALLOC=ON \ -DPIO_ENABLE_TESTS=ON \ -DPIO_ENABLE_EXAMPLES=ON \ ..

make -j4

make tests

ctest

PIO_ENABLE_EXAMPLES is set to ON to enable testing some C examples. PIO_USE_MALLOC is set to ON (recommended) to use native malloc (instead of bget package).

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

dqwu commented 6 months ago

@halehawk ADIOS IO type in SCORPIO has some known limitations, see #553 for detailed information.

For ADIOS type, you should not run all of the unit tests (C and Fortran). In fact, our nightly builds only test a subset of the Fortran unit tests (C unit tests do not support ADIOS type so far), plus C example test_adios.c.

After you install a custom ADIOS 2.9.1 lib on that machine, I would suggest that you test ADIOS write feature first (ADIOS read support has more restrictions).

FYI, below are the commands to test ADIOS write feature:

git clone https://github.com/E3SM-Project/scorpio.git
cd scorpio

mkdir build
cd build

ADIOS2_DIR=/path/to/your/adios2/2.9.1/installation \
CC=mpicc CXX=mpicxx FC=mpif90 cmake -Wno-dev \
-DWITH_NETCDF=OFF \
-DWITH_ADIOS2=ON \
-DADIOS_BP2NC_TEST=ON \
-DPnetCDF_PATH=/glade/u/apps/derecho/23.06/spack/opt/spack/parallel-netcdf/1.12.3/cray-mpich/8.1.25/oneapi/2023.0.0/blyr \
-DPIO_USE_MALLOC=ON \
-DPIO_ENABLE_TESTS=ON \
-DPIO_ENABLE_EXAMPLES=ON \
..

make -j4

make tests

ctest -R "pio_unit_test|^init|pio_file\
|ncdf_get_put|ncdf_inq|ncdf_simple_tests|pio_rearr\
|pio_decomp|pio_sync_tests|pio_buf_lim_tests|pio_iodesc_tests\
|pio_iosystem_tests|examplePio|example1|darray_no_async|test_adios"

Note that we only run a subset of the Fortran unit tests and test_adios example with the ctest command.

Also, ADIOS_BP2NC_TEST is set to ON to perform implicit file conversion (ADIOS to NetCDF) such that we actually read converted .nc files for testing.

dqwu commented 6 months ago

@halehawk For testing ADIOS read feature, we only run test_adios.c example so far (the shorter list of applicable Fortran unit tests has not been determined yet). Simply remove "-DADIOS_BP2NC_TEST=ON" and only run test_adios with the ctest command:

git clone https://github.com/E3SM-Project/scorpio.git
cd scorpio

mkdir build
cd build

ADIOS2_DIR=/path/to/your/adios2/2.9.1/installation \
CC=mpicc CXX=mpicxx FC=mpif90 cmake -Wno-dev \
-DWITH_NETCDF=OFF \
-DWITH_ADIOS2=ON \
-DPnetCDF_PATH=/glade/u/apps/derecho/23.06/spack/opt/spack/parallel-netcdf/1.12.3/cray-mpich/8.1.25/oneapi/2023.0.0/blyr \
-DPIO_USE_MALLOC=ON \
-DPIO_ENABLE_TESTS=ON \
-DPIO_ENABLE_EXAMPLES=ON \
..

make -j4

make tests

ctest -R test_adios
halehawk commented 6 months ago

I tested on pnetcdf with scorpio. Until test#69, all tests passed. LastTest_0104.log

halehawk commented 6 months ago

I tried to compile scorpio with esmf. I included scorpio include path and adios2 include path. But I still got this error: In file included from /glade/.../esmf/src/Infrastructure/IO/src/ESMCI_IO_Handler.C:36: In file included from /glade/.../esmf/src/Infrastructure/IO/src/../include/ESMCI_PIO_Handler.h:45: /glade/.../scorpio/install/include/pio.h:71:10: fatal error: In file included from /glade/.../esmf/src/Infrastructure/IO/src/ESMCI_PIO_Handler.C:'spio_hash.h' file not found27:

It looks like spio_hash.h is not in my scorpio include path, how can I change cmake option to install this header file?

dqwu commented 6 months ago

I tried to compile scorpio with esmf. I included scorpio include path and adios2 include path. But I still got this error: In file included from /glade/.../esmf/src/Infrastructure/IO/src/ESMCI_IO_Handler.C:36: In file included from /glade/.../esmf/src/Infrastructure/IO/src/../include/ESMCI_PIO_Handler.h:45: /glade/.../scorpio/install/include/pio.h:71:10: fatal error: In file included from /glade/.../esmf/src/Infrastructure/IO/src/ESMCI_PIO_Handler.C:'spio_hash.h' file not found27:

It looks like spio_hash.h is not in my scorpio include path, how can I change cmake option to install this header file?

It might take some time for us to fix this issue. If you manually copy spio_hash.h to /glade/.../scorpio/install/include, does it work?

halehawk commented 6 months ago

Yes, this error is gone. Then I got this error /glade/.../esmf/src/Infrastructure/Mesh/src/ESMCI_UGRID_Util.C:357:11: error: use of undeclared identifier 'PIOc_InitDecomp_ReadOnly'

piorc = PIOc_InitDecomp_ReadOnly(pioSystemDesc, PIO_INT,

Is there any macro I should define to avoid this error?

On Wed, Jan 10, 2024 at 3:53 PM dqwu @.***> wrote:

I tried to compile scorpio with esmf. I included scorpio include path and adios2 include path. But I still got this error: In file included from /glade/.../esmf/src/Infrastructure/IO/src/ESMCI_IO_Handler.C:36: In file included from /glade/.../esmf/src/Infrastructure/IO/src/../include/ESMCI_PIO_Handler.h:45: /glade/.../scorpio/install/include/pio.h:71:10: fatal error: In file included from /glade/.../esmf/src/Infrastructure/IO/src/ESMCI_PIO_Handler.C:'spio_hash.h' file not found27:

It looks like spio_hash.h is not in my scorpio include path, how can I change cmake option to install this header file?

It might take some time for us to fix this issue. If you manually copy spio_hash.h to /glade/.../scorpio/install/include, does it work?

— Reply to this email directly, view it on GitHub https://github.com/E3SM-Project/scorpio/issues/554#issuecomment-1885873315, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAPEFAZC63EKDM745JTX6DYN4LV7AVCNFSM6AAAAABBKVPKWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBVHA3TGMZRGU . You are receiving this because you were mentioned.Message ID: @.***>

halehawk commented 6 months ago

And this erro /glade/.../esmf/src/Infrastructure/Mesh/src/ESMCI_Mesh_FileIO.C:219:13: error: use of undeclared identifier 'PIOc_free_iosystem';

dqwu commented 6 months ago

@halehawk It seems that PIOc_InitDecomp_ReadOnly is an API of NCAR PIO, which is not supported by SCORPIO.

dqwu commented 6 months ago

ESMCI_Mesh_FileIO.C might need to be updated to use SCORPIO APIs.

halehawk commented 6 months ago

PIOc_InitDecomp_ReadOnly is a read decomp, can Scorpio read nc files directly?

On Wed, Jan 10, 2024 at 4:13 PM dqwu @.***> wrote:

ESMCI_Mesh_FileIO.C might need to be updated to use SCORPIO APIs.

— Reply to this email directly, view it on GitHub https://github.com/E3SM-Project/scorpio/issues/554#issuecomment-1885894943, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAPEFBYFCKPPEIXUUKRL2DYN4OADAVCNFSM6AAAAABBKVPKWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBVHA4TIOJUGM . You are receiving this because you were mentioned.Message ID: @.***>

dqwu commented 6 months ago

@halehawk I think you can simply use PIOc_InitDecomp() in ESMCI_Mesh_FileIO.C It has the same parameters as PIOc_InitDecomp_ReadOnly() in NCAR PIO code. SCORPIO does not support PIOc_InitDecomp_ReadOnly() so far.

int PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int maplen,
                    const PIO_Offset *compmap, int *ioidp, const int *rearranger,
                    const PIO_Offset *iostart, const PIO_Offset *iocount)

PIOc_InitDecomp_ReadOnly(int iosysid, int pio_type, int ndims, const int *gdimlen, int maplen,
                const PIO_Offset *compmap, int *ioidp, const int *rearranger,
                const PIO_Offset *iostart, const PIO_Offset *iocount)
halehawk commented 6 months ago

After I replaced PIOc_InitDecomp_ReadOnly with PIOc_InitDecomp. I still have the error: And this erro /glade/.../esmf/src/Infrastructure/Mesh/src/ESMCI_Mesh_FileIO.C:219:13: error: use of undeclared identifier 'PIOc_free_iosystem'; Which API can replace PIOc_free_iosystem? Thanks!

dqwu commented 6 months ago

@halehawk You can use PIOc_finalize() instead of PIOc_free_iosystem().

FYI, NCAR PIO added PIOc_free_iosystem() as a duplicate for PIOc_finalize():

There are some naming inconsistencies in the PIO C API. I would like to fix them by adding new functions with better nomenclature, and leaving old functions alone. But the documentation and examples can use the new consistent nomenclature and that will be good.

There are several examples but I will start with the simplest, PIOc_finalize().

The name is confusing because usually finalize means to shut down the library altogether, releasing all resources. However, in our case it just means to release one IOSystem. If multiple IOSystems are in use, then finalize must be called for each of them.

So a better name would be PIOc_free_iosystem();

halehawk commented 6 months ago

OK, I commented free_iosystem out for continuing compilation. I will change to PIOc_finalize. Now Scorpio static libraries cannot be linked its path to load. Do you know where I can add -fPIC in your CMakeLists.txt to build a shared library? Thanks!

jayeshkrishna commented 6 months ago

AFAIK, ESMF currently cannot use SCORPIO (The PIO library added some APIs specifically for ESMF that are currently not available in SCORPIO. It has been in our todo list but hasn't been a high priority task yet.)

dqwu commented 6 months ago

@halehawk E3SM uses static scorpio lib without any build issues. I think you should be able to build your application with static scorpio lib as well. @jayeshkrishna Any thoughts on this?

jayeshkrishna commented 6 months ago

Using static lib should work fine, however as I mentioned above you cannot use SCORPIO with ESMF right now.

halehawk commented 6 months ago

So I just used the scorpio static lib with esmf, and changed the previous two APIs, now at least esmf compiled.

halehawk commented 5 months ago

Though I built scorpio enabled esmf. But when I tried to build this esmf with cesm, I got the following errors: /glade/.../tmp/ifortAc6Qfb.i: error #5286: Ambiguous generic interface PIO_INIT: previously declared specific procedure SPIO_INIT::PIO_INIT_INTRACOMM is not distinguishable from this declaration. [PIOLIB_MOD::INIT_INTRACOM]

/glade/.../tmp/ifortAc6Qfb.i: error #5286: Ambiguous generic interface PIO_SETERRORHANDLING: previously declared specific procedure SPIO_ERR::PIO_SETERRORHANDLING_IOSYS is not distinguishable from this declaration. [PIOLIB_MOD::SETERRORHANDLINGIOSYSTEM]

/glade/.../my_cesm_sandbox1/components/cam/src/dynamics/mpas/dycore/src/framework/mpas_io.F(313): error #6405: The same named entity from different modules and/or program units cannot be referenced. [PIO_OPENFILE]

Is this caused by I included spio header files? If not, how can I use from PIO mode instead of SPIO mod? I looked at the libpiof.a and I only saw: spio_init but not pio_init U PIOc_Init_Intercomm_from_F90 U PIOc_Init_Intracomm_from_F90 0000000000001c40 T spioinit. 0000000000000c00 T spio_init_mp_piofinalize

dqwu commented 5 months ago

SPIO_ERR

You might try configuring scorpio with -DPIO_USE_FORTRAN_LEGACY_LIB=ON

halehawk commented 5 months ago

After I enable -DPIO_USE_FORTRAN_LEGACY_LIB=ON, can I still use PIO_IOTYPE_ADIOS2?

dqwu commented 5 months ago

After I enable -DPIO_USE_FORTRAN_LEGACY_LIB=ON, can I still use PIO_IOTYPE_ADIOS2?

Yes you can.

halehawk commented 5 months ago

Then why are there USE_LEGACY_PIO? What is the difference between using it and not using it?

dqwu commented 5 months ago

Then why are there USE_LEGACY_PIO? What is the difference between using it and not using it?

Please see PR #513 for detailed information. If CESM or ESMF does not support the new Fortran interface of SCORPIO, you might switch back to the legacy interface as a workaround.

dqwu commented 5 months ago

@halehawk Please notice that there might be more issues with your testing. As @jayeshkrishna has mentioned, ESMF does not work with SCORPIO so far.

halehawk commented 5 months ago

So far, the legacy pio worked on cesm/esmf. I just hope scorpio has few issues with esmf and can find replace APIs easily. By the way, I want to know if scorpio can read netcdf files if the pio_iotype is set to adios.

dqwu commented 5 months ago

So far, the legacy pio worked on cesm/esmf. I just hope scorpio has few issues with esmf and can find replace APIs easily. By the way, I want to know if scorpio can read netcdf files if the pio_iotype is set to adios.

When the pio_iotype is set to adios, if only netcdf files exist, scorpio will switch adios type to pnetcdf (or netcdf) type to read them.

halehawk commented 3 months ago

Now I used scorpio to build with cesm, cesm has pio_short type, but scorpio doesn't have it. Do you have any replacement type for pio_short, if you do, which one? Thanks!

dqwu commented 3 months ago

Now I used scorpio to build with cesm, cesm has pio_short type, but scorpio doesn't have it. Do you have any replacement type for pio_short, if you do, which one? Thanks!

We will fix this issue later. For now, you can manual edit src/flib/pio_types.F90 to add 3 new lines:

--- a/src/flib/pio_types.F90
+++ b/src/flib/pio_types.F90
@@ -234,6 +234,7 @@ module pio_types
    integer, public, parameter :: PIO_double = nf_double
    integer, public, parameter :: PIO_real   = nf_real
    integer, public, parameter :: PIO_int    = nf_int
+   integer, public, parameter :: PIO_short  = nf_short
    integer, public, parameter :: PIO_char   = nf_char
    integer, public, parameter :: PIO_noerr  = nf_noerr
    integer, public, parameter :: PIO_WRITE  = nf_write
@@ -262,6 +263,7 @@ module pio_types
    integer, public, parameter :: PIO_double = nf_double
    integer, public, parameter :: PIO_real   = nf_real
    integer, public, parameter :: PIO_int    = nf_int
+   integer, public, parameter :: PIO_short  = nf_short
    integer, public, parameter :: PIO_char   = nf_char
    integer, public, parameter :: PIO_noerr  = nf_noerr
    integer, public, parameter :: PIO_WRITE  = nf_write
@@ -286,6 +288,7 @@ module pio_types
    integer, public, parameter :: PIO_double = 6
    integer, public, parameter :: PIO_real   = 5
    integer, public, parameter :: PIO_int    = 4
+   integer, public, parameter :: PIO_short  = 3
    integer, public, parameter :: PIO_char   = 2
    integer, public, parameter :: PIO_noerr  = 0
    integer, public, parameter :: PIO_MAX_DIMS = PIO_MAX_DIMS_UB
dqwu commented 3 months ago

@halehawk Maybe updating pio_types.F90 is not sufficient. Please wait for further updates, thanks.

halehawk commented 3 months ago

Yes, thank you. It looks like you need to add PIO_SHORT in genf90.pl as well. Another thing, currently I compiled scorpio in adios write mode as you suggested which is enabled BP2NC mode. But the cesm has problem as follows: error #6284: There is no matching specific function for this generic function reference. [PIO_GET_VAR] rcode = pio_get_var(pioid, varid,start=(/1,1,1,nt/),count=(/1,1,1,1/), ival=data_real2d) rcode = pio_get_var(pioid, varid,start=(/1,1,nt/),count=(/1,1,1/), ival=data_real1d) rcode = pio_get_var(pioid, varid,start=(/1,1,1,nt/), count=(/1,1,1,1/), ival=data_dbl2d) rcode = pio_get_var(pioid, varid,start=(/1,1,nt/), count=(/1,1,1/), ival=data_dbl1d) Do you know if it caused by BP2NC mode or netcdf disabled? Thanks!

dqwu commented 3 months ago

Yes, thank you. It looks like you need to add PIO_SHORT in genf90.pl as well. Another thing, currently I compiled scorpio in adios write mode as you suggested which is enabled BP2NC mode. But the cesm has problem as follows: error #6284: There is no matching specific function for this generic function reference. [PIO_GET_VAR] rcode = pio_get_var(pioid, varid,start=(/1,1,1,nt/),count=(/1,1,1,1/), ival=data_real2d) rcode = pio_get_var(pioid, varid,start=(/1,1,nt/),count=(/1,1,1/), ival=data_real1d) rcode = pio_get_var(pioid, varid,start=(/1,1,1,nt/), count=(/1,1,1,1/), ival=data_dbl2d) rcode = pio_get_var(pioid, varid,start=(/1,1,nt/), count=(/1,1,1/), ival=data_dbl1d) Do you know if it caused by BP2NC mode or netcdf disabled? Thanks!

Are you using PIO_SHORT for these calls? Maybe the Fortran interface pio_get_var (and some others) needs to be updated to support PIO_SHORT as well.

dqwu commented 3 months ago

NCAR PIO has added support for PIO_SHORT, and it seems that there are quite a few files updated: https://github.com/NCAR/ParallelIO/pull/1653/files

halehawk commented 3 months ago

No, you can see the data type is double1d, double2d, real1d, real2d in these calls. I will update scorpio and try again.

On Fri, Mar 22, 2024 at 8:30 AM dqwu @.***> wrote:

Yes, thank you. It looks like you need to add PIO_SHORT in genf90.pl as well. Another thing, currently I compiled scorpio in adios write mode as you suggested which is enabled BP2NC mode. But the cesm has problem as follows: error #6284: There is no matching specific function for this generic function reference. [PIO_GET_VAR] rcode = pio_get_var(pioid, varid,start=(/1,1,1,nt/),count=(/1,1,1,1/), ival=data_real2d) rcode = pio_get_var(pioid, varid,start=(/1,1,nt/),count=(/1,1,1/), ival=data_real1d) rcode = pio_get_var(pioid, varid,start=(/1,1,1,nt/), count=(/1,1,1,1/), ival=data_dbl2d) rcode = pio_get_var(pioid, varid,start=(/1,1,nt/), count=(/1,1,1/), ival=data_dbl1d) Do you know if it caused by BP2NC mode or netcdf disabled? Thanks!

Are you using PIO_SHORT for these calls? Maybe the Fortran interface pio_get_var (and some others) needs to be updated to support PIO_SHORT as well.

— Reply to this email directly, view it on GitHub https://github.com/E3SM-Project/scorpio/issues/554#issuecomment-2015229396, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAPEFDXABZ2LWYOZ6AG5H3YZQ6A3AVCNFSM6AAAAABBKVPKWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJVGIZDSMZZGY . You are receiving this because you were mentioned.Message ID: @.***>

halehawk commented 3 months ago

Now I am trying to build the scorpio latest version, I got the following error even after I set PIO_ENABLE_LOGGING=ON /.../haiyingx/scorpio/src/clib/pioc_support.c:3020:24: error: call to undeclared function 'symlink'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] ierr = symlink(file->filename, filename); I used intel/2023.0.0, cray-mpich/8.1.25, craype/2.7.20. This software environment is required by cesm. Do you know if the intel compiler is too old to use symlink?

halehawk commented 3 months ago

It's not compiler problem, I tested with a simple c code, it can create a symbolic link on my machine by ICC or ICX.

halehawk commented 3 months ago

I double checked with a simple testcase for scorpio pio_get_var with arguments (file, varid,start, count,val), it cannot find matching functions, but if I called pio_get_var with (file,varid, val), it works. So is scorpio supposed to not support pio_get_var(file,varid,start,count,val) or pio_get_var(file, vardesc,start,count, val)? If scorpio does support, I suspect that the declaration of pio_get_var(file,varid,start,count,val) is not correct after you generate spio_get_var using genf90.pl. Could you please have a look?

dqwu commented 3 months ago

I double checked with a simple testcase for scorpio pio_get_var with arguments (file, varid,start, count,val), it cannot find matching functions, but if I called pio_get_var with (file,varid, val), it works. So is scorpio supposed to not support pio_get_var(file,varid,start,count,val) or pio_get_var(file, vardesc,start,count, val)? If scorpio does support, I suspect that the declaration of pio_get_var(file,varid,start,count,val) is not correct after you generate spio_get_var using genf90.pl. Could you please have a look?

pio_get_var(file,varid,start,count,val) should be supported by SCORPIO. Maybe it is the type of val that is not supported (e.g. PIO_SHORT)?

As we've mentioned before, ESMF currently isn't compatible with SCORPIO, and we don't recommend further testing. Even after resolving some known issues (such as PIO_SHORT not being supported), you're likely to encounter additional unexpected issues while testing ESMF with SCORPIO.

dqwu commented 3 months ago

@halehawk For pio_get_var(), you might also try legacy Fortran interface. Edit scorpio/CMakeLists.txt and set PIO_USE_FORTRAN_LEGACY_LIB to ON by default: option (PIO_USE_FORTRAN_LEGACY_LIB "Use the legacy Fortran library" ON)

halehawk commented 3 months ago

The situation is I want to use adios to write and netcdf to read, if I turn on fortran legacy, it looks like I cannot use adios to write in fortran code.

halehawk commented 3 months ago

I didn't mean pio_get_var for PIO_SHORT, I mean pio_get_var for PIO_REAL and PIO_DOUBLE, you declared four modules in the pio_get_var for 1d_real, I tested I only can use pio_get_var with (file,varid, val) or (file,vardesc,val), but not pio_get_var with (file,varid,start,count,val) or (file,vardesc,start,count,val). And also I didn't get this problem from esmf, but from "use pio: pio_get_var" directly. So that's why I want to ask for your help.