From 33f951d2d5e830131806e6d1eaf7ff304859fa57 Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Tue, 2 Apr 2024 19:05:35 +0200 Subject: [PATCH] Remove par access from file --- netcdf-examples/src/parallel.rs | 4 ++-- netcdf/src/file.rs | 27 --------------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/netcdf-examples/src/parallel.rs b/netcdf-examples/src/parallel.rs index 3b93818..48c414d 100644 --- a/netcdf-examples/src/parallel.rs +++ b/netcdf-examples/src/parallel.rs @@ -18,7 +18,7 @@ fn create( ) -> Result<(), Box> { 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(); @@ -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::((.., rank as usize))?; for (t, &v) in values.iter().enumerate() { diff --git a/netcdf/src/file.rs b/netcdf/src/file.rs index 3bf2481..9431310 100644 --- a/netcdf/src/file.rs +++ b/netcdf/src/file.rs @@ -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.