Skip to content

Commit ffbda15

Browse files
committed
Remove par access from file
1 parent b482f1e commit ffbda15

File tree

2 files changed

+7
-30
lines changed

2 files changed

+7
-30
lines changed

netcdf-examples/src/parallel.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ fn create(
1717
communicator: impl Communicator + AsRaw<Raw = mpi_sys::MPI_Comm>,
1818
) -> Result<(), Box<dyn std::error::Error>> {
1919
let info = mpi_null_info();
20-
let mut file =
21-
netcdf::create_par_with(path, communicator.as_raw(), info, netcdf::Options::empty())?;
20+
let mut file = netcdf::create_par_with(
21+
path,
22+
communicator.as_raw(),
23+
info,
24+
netcdf::Options::NETCDF4(),
25+
)?;
2226

2327
let size = communicator.size() as usize;
2428
let rank = communicator.rank();
@@ -45,10 +49,10 @@ fn read(
4549
let info = mpi_null_info();
4650

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

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

5458
for (t, &v) in values.iter().enumerate() {

netcdf/src/file.rs

-27
Original file line numberDiff line numberDiff line change
@@ -317,33 +317,6 @@ impl File {
317317
let Self(file) = self;
318318
file.close()
319319
}
320-
321-
/// Access all variable in independent mode
322-
/// for parallell reading using MPI.
323-
/// File must have been opened using `open_par`
324-
///
325-
/// This is the default access mode
326-
#[cfg(feature = "mpi")]
327-
pub fn access_independent(&self) -> error::Result<()> {
328-
let ncid = self.ncid();
329-
crate::par::set_access_mode(
330-
ncid,
331-
netcdf_sys::NC_GLOBAL,
332-
crate::par::AccessMode::Independent,
333-
)
334-
}
335-
/// Access all variable in collective mode
336-
/// for parallell reading using MPI.
337-
/// File must have been opened using `open_par`
338-
#[cfg(feature = "mpi")]
339-
pub fn access_collective(&self) -> error::Result<()> {
340-
let ncid = self.ncid();
341-
crate::par::set_access_mode(
342-
ncid,
343-
netcdf_sys::NC_GLOBAL,
344-
crate::par::AccessMode::Collective,
345-
)
346-
}
347320
}
348321

349322
/// Mutable access to file.

0 commit comments

Comments
 (0)