-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
838 additions
and
809 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"rust-analyzer.linkedProjects": [ | ||
"./tree/Cargo.toml", | ||
"./tree/Cargo.toml", | ||
"./tree/Cargo.toml", | ||
"./tree/Cargo.toml", | ||
"./tree/Cargo.toml" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,82 @@ | ||
// use memoffset::offset_of; | ||
// use mpi::{ | ||
// datatype::{Equivalence, UncommittedUserDatatype, UserDatatype}, | ||
// topology::UserCommunicator, | ||
// traits::*, | ||
// Address, | ||
// }; | ||
use memoffset::offset_of; | ||
use mpi::{ | ||
datatype::{Equivalence, UncommittedUserDatatype, UserDatatype}, | ||
topology::UserCommunicator, | ||
traits::*, | ||
Address, | ||
}; | ||
|
||
// use crate::types::{domain::Domain, point::PointType}; | ||
use crate::types::{domain::Domain, point::PointType}; | ||
|
||
// unsafe impl Equivalence for Domain { | ||
// type Out = UserDatatype; | ||
// fn equivalent_datatype() -> Self::Out { | ||
// UserDatatype::structured( | ||
// &[1, 1], | ||
// &[ | ||
// offset_of!(Domain, origin) as Address, | ||
// offset_of!(Domain, diameter) as Address, | ||
// ], | ||
// &[ | ||
// UncommittedUserDatatype::contiguous(3, &PointType::equivalent_datatype()).as_ref(), | ||
// UncommittedUserDatatype::contiguous(3, &PointType::equivalent_datatype()).as_ref(), | ||
// ], | ||
// ) | ||
// } | ||
// } | ||
unsafe impl Equivalence for Domain { | ||
type Out = UserDatatype; | ||
fn equivalent_datatype() -> Self::Out { | ||
UserDatatype::structured( | ||
&[1, 1], | ||
&[ | ||
offset_of!(Domain, origin) as Address, | ||
offset_of!(Domain, diameter) as Address, | ||
], | ||
&[ | ||
UncommittedUserDatatype::contiguous(3, &PointType::equivalent_datatype()).as_ref(), | ||
UncommittedUserDatatype::contiguous(3, &PointType::equivalent_datatype()).as_ref(), | ||
], | ||
) | ||
} | ||
} | ||
|
||
// impl Domain { | ||
// /// Compute the points domain over all nodes. | ||
// pub fn from_global_points(local_points: &[[PointType; 3]], comm: &UserCommunicator) -> Domain { | ||
// let size = comm.size(); | ||
impl Domain { | ||
/// Compute the points domain over all nodes. | ||
pub fn from_global_points(local_points: &[PointType], comm: &UserCommunicator) -> Domain { | ||
let size = comm.size(); | ||
|
||
// let local_domain = Domain::from_local_points(local_points); | ||
// let local_bounds: Vec<Domain> = vec![local_domain; size as usize]; | ||
// let mut buffer = vec![Domain::default(); size as usize]; | ||
let local_domain = Domain::from_local_points(local_points); | ||
let local_bounds: Vec<Domain> = vec![local_domain; size as usize]; | ||
let mut buffer = vec![Domain::default(); size as usize]; | ||
|
||
// comm.all_to_all_into(&local_bounds, &mut buffer[..]); | ||
comm.all_to_all_into(&local_bounds, &mut buffer[..]); | ||
|
||
// // Find minimum origin | ||
// let min_x = buffer | ||
// .iter() | ||
// .min_by(|a, b| a.origin[0].partial_cmp(&b.origin[0]).unwrap()) | ||
// .unwrap() | ||
// .origin[0]; | ||
// let min_y = buffer | ||
// .iter() | ||
// .min_by(|a, b| a.origin[1].partial_cmp(&b.origin[1]).unwrap()) | ||
// .unwrap() | ||
// .origin[1]; | ||
// let min_z = buffer | ||
// .iter() | ||
// .min_by(|a, b| a.origin[2].partial_cmp(&b.origin[2]).unwrap()) | ||
// .unwrap() | ||
// .origin[2]; | ||
// Find minimum origin | ||
let min_x = buffer | ||
.iter() | ||
.min_by(|a, b| a.origin[0].partial_cmp(&b.origin[0]).unwrap()) | ||
.unwrap() | ||
.origin[0]; | ||
let min_y = buffer | ||
.iter() | ||
.min_by(|a, b| a.origin[1].partial_cmp(&b.origin[1]).unwrap()) | ||
.unwrap() | ||
.origin[1]; | ||
let min_z = buffer | ||
.iter() | ||
.min_by(|a, b| a.origin[2].partial_cmp(&b.origin[2]).unwrap()) | ||
.unwrap() | ||
.origin[2]; | ||
|
||
// let min_origin = [min_x, min_y, min_z]; | ||
let min_origin = [min_x, min_y, min_z]; | ||
|
||
// // Find maximum diameter (+max origin) | ||
// let max_x = buffer | ||
// .iter() | ||
// .max_by(|a, b| a.diameter[0].partial_cmp(&b.diameter[0]).unwrap()) | ||
// .unwrap() | ||
// .diameter[0]; | ||
// let max_y = buffer | ||
// .iter() | ||
// .max_by(|a, b| a.diameter[1].partial_cmp(&b.diameter[1]).unwrap()) | ||
// .unwrap() | ||
// .diameter[1]; | ||
// let max_z = buffer | ||
// .iter() | ||
// .max_by(|a, b| a.diameter[2].partial_cmp(&b.diameter[2]).unwrap()) | ||
// .unwrap() | ||
// .diameter[2]; | ||
// Find maximum diameter (+max origin) | ||
let max_x = buffer | ||
.iter() | ||
.max_by(|a, b| a.diameter[0].partial_cmp(&b.diameter[0]).unwrap()) | ||
.unwrap() | ||
.diameter[0]; | ||
let max_y = buffer | ||
.iter() | ||
.max_by(|a, b| a.diameter[1].partial_cmp(&b.diameter[1]).unwrap()) | ||
.unwrap() | ||
.diameter[1]; | ||
let max_z = buffer | ||
.iter() | ||
.max_by(|a, b| a.diameter[2].partial_cmp(&b.diameter[2]).unwrap()) | ||
.unwrap() | ||
.diameter[2]; | ||
|
||
// let max_diameter = [max_x, max_y, max_z]; | ||
let max_diameter = [max_x, max_y, max_z]; | ||
|
||
// Domain { | ||
// origin: min_origin, | ||
// diameter: max_diameter, | ||
// } | ||
// } | ||
// } | ||
Domain { | ||
origin: min_origin, | ||
diameter: max_diameter, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
// use crate::types::morton::{KeyType, MortonKey}; | ||
// use memoffset::offset_of; | ||
// use mpi::{ | ||
// datatype::{Equivalence, UncommittedUserDatatype, UserDatatype}, | ||
// Address, | ||
// }; | ||
use crate::types::morton::{KeyType, MortonKey}; | ||
use memoffset::offset_of; | ||
use mpi::{ | ||
datatype::{Equivalence, UncommittedUserDatatype, UserDatatype}, | ||
Address, | ||
}; | ||
|
||
// unsafe impl Equivalence for MortonKey { | ||
// type Out = UserDatatype; | ||
// fn equivalent_datatype() -> Self::Out { | ||
// UserDatatype::structured( | ||
// &[1, 1], | ||
// &[ | ||
// offset_of!(MortonKey, anchor) as Address, | ||
// offset_of!(MortonKey, morton) as Address, | ||
// ], | ||
// &[ | ||
// UncommittedUserDatatype::contiguous(3, &KeyType::equivalent_datatype()).as_ref(), | ||
// UncommittedUserDatatype::contiguous(1, &KeyType::equivalent_datatype()).as_ref(), | ||
// ], | ||
// ) | ||
// } | ||
// } | ||
unsafe impl Equivalence for MortonKey { | ||
type Out = UserDatatype; | ||
fn equivalent_datatype() -> Self::Out { | ||
UserDatatype::structured( | ||
&[1, 1], | ||
&[ | ||
offset_of!(MortonKey, anchor) as Address, | ||
offset_of!(MortonKey, morton) as Address, | ||
], | ||
&[ | ||
UncommittedUserDatatype::contiguous(3, &KeyType::equivalent_datatype()).as_ref(), | ||
UncommittedUserDatatype::contiguous(1, &KeyType::equivalent_datatype()).as_ref(), | ||
], | ||
) | ||
} | ||
} |
Oops, something went wrong.