Skip to content

Commit

Permalink
Fix the fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dalg24 committed Jan 13, 2024
1 parent 4ba8c35 commit 20a31ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
15 changes: 9 additions & 6 deletions core/src/Cuda/Kokkos_Cuda_Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,11 +641,12 @@ Kokkos::Cuda::initialize WARNING: Cuda is allocating into UVMSpace by default

// Allocate a staging buffer for constant mem in pinned host memory and an
// event to avoid overwriting driver for previous kernel launches
KOKKOS_IMPL_CUDA_SAFE_CALL(
cudaMallocHost(reinterpret_cast<void **>(&constantMemHostStaging),
CudaTraits::ConstantMemoryUsage));
KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMallocHost(
reinterpret_cast<void **>(&Impl::CudaInternal::constantMemHostStaging),
Impl::CudaTraits::ConstantMemoryUsage));

KOKKOS_IMPL_CUDA_SAFE_CALL(cudaEventCreate(&constantMemReusable));
KOKKOS_IMPL_CUDA_SAFE_CALL(
cudaEventCreate(&Impl::CudaInternal::constantMemReusable));

Impl::CudaInternal::singleton().initialize(singleton_stream,
/*manage*/ true);
Expand All @@ -656,8 +657,10 @@ void Cuda::impl_finalize() {

desul::Impl::finalize_lock_arrays(); // FIXME

KOKKOS_IMPL_CUDA_SAFE_CALL(cudaEventDestroy(constantMemReusable));
KOKKOS_IMPL_CUDA_SAFE_CALL(cudaFreeHost(constantMemHostStaging));
KOKKOS_IMPL_CUDA_SAFE_CALL(
cudaEventDestroy(Impl::CudaInternal::constantMemReusable));
KOKKOS_IMPL_CUDA_SAFE_CALL(
cudaFreeHost(Impl::CudaInternal::constantMemHostStaging));

auto &deep_copy_space = Impl::cuda_get_deep_copy_space(/*initialize*/ false);
if (deep_copy_space)
Expand Down
6 changes: 4 additions & 2 deletions core/src/HIP/Kokkos_HIP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ void HIP::impl_finalize() {

desul::Impl::finalize_lock_arrays(); // FIXME

KOKKOS_IMPL_HIP_SAFE_CALL(hipEventDestroy(constantMemReusable));
KOKKOS_IMPL_HIP_SAFE_CALL(hipHostFree(constantMemHostStaging));
KOKKOS_IMPL_HIP_SAFE_CALL(
hipEventDestroy(Impl::HIPInternal::constantMemReusable));
KOKKOS_IMPL_HIP_SAFE_CALL(
hipHostFree(Impl::HIPInternal::constantMemHostStaging));

Impl::HIPInternal::singleton().finalize();
}
Expand Down

0 comments on commit 20a31ae

Please sign in to comment.