mirror of
https://github.com/xythrez/RustMP.git
synced 2025-09-04 21:52:36 +00:00
Keyword change again: shared, shared_mut, shared_unsafe
This commit is contained in:
parent
438622d8f1
commit
0b22ea2395
3 changed files with 44 additions and 44 deletions
|
@ -40,7 +40,7 @@ fn main() {
|
|||
let result = gen_empty(nsize);
|
||||
let timer = Instant::now();
|
||||
par_for! {
|
||||
for i in 0..nsize, locked result, read matrix, {
|
||||
for i in 0..nsize, shared_mut result, shared matrix, {
|
||||
for j in 0..nsize {
|
||||
let mut sum = 0.0;
|
||||
for k in 0..nsize {
|
||||
|
|
|
@ -31,7 +31,7 @@ fn main() {
|
|||
let numbers: Vec<Student> = vec![];
|
||||
|
||||
par_for! {
|
||||
for i in 1..32, blocksize 4, locked numbers, {
|
||||
for i in 1..32, blocksize 4, shared_mut numbers, {
|
||||
//std::thread::sleep(
|
||||
// time::Duration::from_secs(
|
||||
// rand::thread_rng().gen_range(1..10)));
|
||||
|
@ -57,7 +57,7 @@ fn main() {
|
|||
for j in 0..n {
|
||||
let mut x = 0;
|
||||
par_for! {
|
||||
for k in 0..n, read a b, reduction x#+, {
|
||||
for k in 0..n, shared a b, reduction x#+, {
|
||||
x += (a[i][k]*b[k][j]);
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ fn main() {
|
|||
println!("{:?}", c);
|
||||
// let mut local = 0;
|
||||
// par_for! {
|
||||
// for i in 1..32, blocksize 1, locked numbers, private local, {
|
||||
// for i in 1..32, blocksize 1, shared_mut numbers, private local, {
|
||||
// local += 1;
|
||||
// println!("{}", local);
|
||||
// let mut lock = numbers.write();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue