Skip to content

Commit

Permalink
Make CU_DEVICE_CPU the default option for memPrefetchAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
csbnw committed Sep 20, 2023
1 parent e884449 commit 43128db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/cudawrappers/cu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,8 @@ class Stream : public Wrapper<CUstream> {
checkCudaCall(cuMemcpyAsync(dstPtr, srcPtr, size, _obj));
}

void memPrefetchAsync(CUdeviceptr devPtr, size_t size, CUdevice dstDevice) {
void memPrefetchAsync(CUdeviceptr devPtr, size_t size,
CUdevice dstDevice = CU_DEVICE_CPU) {
checkCudaCall(cuMemPrefetchAsync(devPtr, size, dstDevice, _obj));
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_vector_add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ TEST_CASE("Vector add") {
stream.memPrefetchAsync(d_a, bytesize, device);
stream.memPrefetchAsync(d_b, bytesize, device);
stream.launchKernel(function, 1, 1, 1, N, 1, 1, 0, parameters);
stream.memPrefetchAsync(d_c, bytesize, CU_DEVICE_CPU);
stream.memPrefetchAsync(d_c, bytesize);
stream.synchronize();

check_arrays_equal(h_c, reference_c.data(), N);
Expand Down

0 comments on commit 43128db

Please sign in to comment.