Skip to content

Commit 0c577d3

Browse files
committed
fixed remaining get_access
Signed-off-by: todd.erdner <[email protected]>
1 parent 0ea231b commit 0c577d3

File tree

1 file changed

+13
-10
lines changed
  • DirectProgramming/DPC++/ParallelPatterns/dpc_reduce/src

1 file changed

+13
-10
lines changed

DirectProgramming/DPC++/ParallelPatterns/dpc_reduce/src/main.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,11 @@ float calc_pi_dpstd_native(size_t num_steps, Policy&& policy) {
8989
});
9090
policy.queue().wait();
9191

92-
float mynewresult =
93-
buf.get_access<access::mode::read>()[0] / (float)num_steps;
92+
93+
// float mynewresult = buf.get_access<access::mode::read>()[0] / (float)num_steps;
94+
host_accessor answer(buf,read_only) ;
95+
float mynewresult = answer[0]/(float)num_steps;
96+
9497
return mynewresult;
9598
}
9699

@@ -386,10 +389,9 @@ float calc_pi_dpstd_native3(size_t num_steps, int groups, Policy&& policy) {
386389
countby2 *= 2;
387390
} while (countby2 < n_groups);
388391
}
389-
390-
float answer = temp_buf.template get_access<access::mode::read>()[0];
391-
result = answer / (float)num_steps;
392-
return result;
392+
393+
host_accessor answer(temp_buf,read_only) ;
394+
return answer[0]/(float)num_steps;
393395
}
394396

395397
// dpstd_native4 fills a buffer with number 1...num_steps and then
@@ -495,10 +497,11 @@ float calc_pi_dpstd_native4(size_t num_steps, int groups, Policy&& policy) {
495497
countby2 *= 2;
496498
} while (countby2 < n_groups);
497499
}
498-
float answer = temp_buf.template get_access<access::mode::read_write>()[0];
499-
result = answer / (float)num_steps;
500-
501-
return result;
500+
// float answer = temp_buf.template get_access<access::mode::read_write>()[0];
501+
// result = answer / (float)num_steps;
502+
503+
host_accessor answer(temp_buf,read_only) ;
504+
return answer[0]/(float)num_steps;
502505
}
503506

504507
// This function shows the use of two different DPC++ library calls.

0 commit comments

Comments
 (0)