Skip to content

Commit

Permalink
Remove par access from file
Browse files Browse the repository at this point in the history
  • Loading branch information
mulimoen committed Apr 2, 2024
1 parent b482f1e commit 33f951d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
4 changes: 2 additions & 2 deletions netcdf-examples/src/parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn create(
) -> Result<(), Box<dyn std::error::Error>> {
let info = mpi_null_info();
let mut file =
netcdf::create_par_with(path, communicator.as_raw(), info, netcdf::Options::empty())?;
netcdf::create_par_with(path, communicator.as_raw(), info, netcdf::Options::NETCDF4)?;

let size = communicator.size() as usize;
let rank = communicator.rank();
Expand All @@ -45,10 +45,10 @@ fn read(
let info = mpi_null_info();

let file = netcdf::open_par_with(path, communicator.as_raw(), info, netcdf::Options::empty())?;
file.access_collective()?;

let rank = communicator.rank();
let var = file.variable("output").unwrap();
var.access_collective()?;
let values = var.get::<i32, _>((.., rank as usize))?;

for (t, &v) in values.iter().enumerate() {
Expand Down
27 changes: 0 additions & 27 deletions netcdf/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,33 +317,6 @@ impl File {
let Self(file) = self;
file.close()
}

/// Access all variable in independent mode
/// for parallell reading using MPI.
/// File must have been opened using `open_par`
///
/// This is the default access mode
#[cfg(feature = "mpi")]
pub fn access_independent(&self) -> error::Result<()> {
let ncid = self.ncid();
crate::par::set_access_mode(
ncid,
netcdf_sys::NC_GLOBAL,
crate::par::AccessMode::Independent,
)
}
/// Access all variable in collective mode
/// for parallell reading using MPI.
/// File must have been opened using `open_par`
#[cfg(feature = "mpi")]
pub fn access_collective(&self) -> error::Result<()> {
let ncid = self.ncid();
crate::par::set_access_mode(
ncid,
netcdf_sys::NC_GLOBAL,
crate::par::AccessMode::Collective,
)
}
}

/// Mutable access to file.
Expand Down

0 comments on commit 33f951d

Please sign in to comment.