NCAR / ParallelIO

A high-level Parallel I/O Library for structured grid applications
Apache License 2.0
136 stars 53 forks source link

PIO example run issue #1983

Closed Arunipm closed 10 months ago

Arunipm commented 10 months ago

Hell All, I am very new to PIO library. I would like to run a example examplePio.F90/examplePio.c but did not get success. Could somebody please tell me the correct procedure to run a PIO example !

Thanks & Regards Arun

jedwards4b commented 10 months ago

Hi Arun, Perhaps a little more detail about the problem you are encountering would be helpful. Are you able to run the tests? On an interactive node login you should be able to run ctest. Here are the steps on my system, your system may vary. I am using the latest pio2.6.2 version:

Currently Loaded Modules:
  1) cesmdev/1.0   (H,S)   3) conda/latest     5) craype/2.7.23       7) parallel-netcdf/1.12.3   9) netcdf-mpi/4.9.2
  2) ncarenv/23.09 (S)     4) intel/2023.2.1   6) cray-mpich/8.1.27   8) hdf5-mpi/1.12.2         10) cmake/3.26.3
git clone https://github.com/NCAR/ParallelIO 
cd ParallelIO
mkdir bld
cd bld
CC=mpicc FC=mpif90 cmake ../
make tests
ctest < This step must be done on a node where mpirun works

after lots of output

100% tests passed, 0 tests failed out of 109

mpirun -np 4 examples/c/examplePio

Running with 4 MPI processes and 4 PIO processes.

Produces file examplePio_c.nc

ncdump examplePio_c.nc
netcdf examplePio_c {
dimensions:
    x = 16 ;
variables:
    int foo(x) ;
data:

 foo = 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45 ;
}

The f90 example is not built by default:

make exampleAsyncPio_f90
[ 10%] Built target genf90
[ 30%] Built target gptl
[ 70%] Built target pioc
[100%] Built target piof
[100%] Building Fortran object examples/f03/CMakeFiles/exampleAsyncPio_f90.dir/exampleAsyncPio.F90.o
[100%] Linking Fortran executable exampleAsyncPio_f90
[100%] Built target exampleAsyncPio_f90
mpirun -np 4 examples/f03/exampleAsyncPio_f90 
(t_initf) Read in prof_inparm namelist from: timing.nl
(t_initf) Read in prof_inparm namelist from: timing.nl
(t_initf) Using profile_disable= F  profile_timer=           4
(t_initf)  profile_depth_limit=       99999  profile_detail_limit=           1
(t_initf)  profile_barrier= F  profile_outpe_num=           0
(t_initf)  profile_outpe_stride=           1  profile_single_file= F
(t_initf)  profile_global_stats= T  profile_papi_enable= F
(t_initf) Read in prof_inparm namelist from: timing.nl
(t_initf) Using profile_disable= F  profile_timer=           4
(t_initf)  profile_depth_limit=       99999  profile_detail_limit=           1
(t_initf)  profile_barrier= F  profile_outpe_num=           0
(t_initf)  profile_outpe_stride=           1  profile_single_file= F
(t_initf)  profile_global_stats= T  profile_papi_enable= F
(t_initf) Read in prof_inparm namelist from: timing.nl
(t_initf) Using profile_disable= F  profile_timer=           4
(t_initf)  profile_depth_limit=       99999  profile_detail_limit=           1
(t_initf)  profile_barrier= F  profile_outpe_num=           0
(t_initf)  profile_outpe_stride=           1  profile_single_file= F
(t_initf)  profile_global_stats= T  profile_papi_enable= F
(t_initf) Using profile_disable= F  profile_timer=           4
(t_initf)  profile_depth_limit=       99999  profile_detail_limit=           1
(t_initf)  profile_barrier= F  profile_outpe_num=           0
(t_initf)  profile_outpe_stride=           1  profile_single_file= F
(t_initf)  profile_global_stats= T  profile_papi_enable= F

Creates file examplePio_f90.nc

 ncdump  examplePio_f90.nc
netcdf examplePio_f90 {
dimensions:
    x = 16 ;
variables:
    int foo(x) ;
data:

 foo = 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 0 ;
}
Arunipm commented 10 months ago

Hi Jim, Thank you for your detailed answer. I have already installed PIO-2.5.9 successfully. Actually, I would like to compile and run an example such as examplePio.F90 or examplePio.c, separately. Is it possible to run the command mpif90 examplePio.F90 and get corresponding binary version of the program ? so that I can run it with mpirun. What environment variables or compilers I need to set for it ? I am interested in modifying the content of examplePio.F90 and perform some tests.

Thanks & Regards Arun

jedwards4b commented 10 months ago

I recommend updating to pio.2.6.2 first. Then after following the build instructions above you may build the examples using make <target>where target may be exampleAsyncPio_f90 or examplePio_f90

If you want to use the examples with a spack installed version of PIO then you would need to create a Makefile with:

FC = 
PIO_PATH =
NETCDF_PATH=
PNETCDF_PATH=
FFLAGS = -I$(PIO_PATH)/include -I$(NETCDF_PATH)/include -I$(PNETCDF_PATH)/include 

LIBS = -L$(NETCDF_PATH)/lib -lnetcdff -lnetcdf -L$(PNETCDF_PATH)/lib -lpnetcdf -L$(PIO_PATH)/lib -lpiof -lpioc 

examplePio_f90: examplePio.F90
     $(FC) $(FFLAGS) -o $@ $< $(LIBS)

Filling in the blanks as appropriate for your system.

Arunipm commented 10 months ago

Thank you very much. I am able to run the example now.