Skip to content

parallel=True fallback to format='NETCDF4' with NetCDF-C-4.6.2 and NetCDF-C-4.6.3 #891

Description

@gihankarunarathne

I have tested this on;

hdf5-1.10.4
NETCDF_C_VERSION 4.6.2 / 4.6.3
netcdf4-python-1.4.3

I can pass the format as NETCDF4_CLASSIC with fix for #890 , it isn't giving the error anymore. But the data_model is setting to the NETCDF4 when parallel=True and using NetCDF-C-4.6.2 and NetCDF-C-4.6.3. These are the args which I'm using for the build NetCDF-C.

./configure --prefix=/usr/local --enable-netcdf-4 --enable-shared --enable-parallel4 --enable-parallel-tests --disable-da

So, I don't this, it's related to #820 . When I tried to create a NETCDF4_CLASSIC with python interpreter with parallel=True;

>>> import netCDF4
>>> import numpy as np
>>> ncfile = netCDF4.Dataset('mpi_data_test.nc', mode='w', parallel=True, format='NETCDF4_CLASSIC')
>>> ncfile.data_model
'NETCDF4'
>>> ncfile = netCDF4.Dataset('mpi_data_test.nc', mode='w', parallel=False, format='NETCDF4_CLASSIC')
>>> ncfile.data_model
'NETCDF4_CLASSIC'

When I tried to run the mpi_example.py. Head of mpi_example.py

# to run: mpirun -np 4 python mpi_example.py
from mpi4py import MPI
import numpy as np
from netCDF4 import Dataset
rank = MPI.COMM_WORLD.rank  # The process ID (integer 0-3 for 4-process run)
nc = Dataset('/tmp/parallel_test.nc', 'w', parallel=True, format='NETCDF4_CLASSIC', comm=MPI.COMM_WORLD, info=MPI.Info())
# below should work also - MPI_COMM_WORLD and MPI_INFO_NULL will be used.
#nc = Dataset('/tmp/parallel_test.nc', 'w', parallel=True, format='NETCDF4_CLASSIC')
d = nc.createDimension('dim',4)
v = nc.createVariable('var', np.int, 'dim')

Tried on the output file:

>>> import numpy as np
>>> from netCDF4 import Dataset
>>> nc = Dataset('/tmp/parallel_test.nc', 'r')
>>> nc.data_model
'NETCDF4'

But it's working fine with NetCDF-C-4.6.1;

hdf5-1.10.4
NETCDF_C_VERSION 4.6.1
netcdf4-python-1.4.3
>>> import netCDF4
>>> import numpy as np
>>> ncfile = netCDF4.Dataset('mpi_data_test.nc', mode='w', parallel=True, format='NETCDF4_CLASSIC')
>>> ncfile.data_model
'NETCDF4_CLASSIC'
>>> ncfile = netCDF4.Dataset('mpi_data_test.nc', mode='w', parallel=True, format='NETCDF4')
>>> ncfile.data_model
'NETCDF4'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions