Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(gpu): pass over all cuda bind #1514

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions backends/tfhe-cuda-backend/cuda/include/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ void *cuda_malloc_async(uint64_t size, cudaStream_t stream, uint32_t gpu_index);

void cuda_check_valid_malloc(uint64_t size, uint32_t gpu_index);

bool cuda_check_support_cooperative_groups();

bool cuda_check_support_thread_block_clusters();

void cuda_memcpy_async_to_gpu(void *dest, void *src, uint64_t size,
cudaStream_t stream, uint32_t gpu_index);

Expand All @@ -62,9 +58,13 @@ void cuda_synchronize_device(uint32_t gpu_index);
void cuda_drop(void *ptr, uint32_t gpu_index);

void cuda_drop_async(void *ptr, cudaStream_t stream, uint32_t gpu_index);
}

int cuda_get_max_shared_memory(uint32_t gpu_index);
}

bool cuda_check_support_cooperative_groups();

bool cuda_check_support_thread_block_clusters();

template <typename Torus>
void cuda_set_value_async(cudaStream_t stream, uint32_t gpu_index,
Expand Down
2 changes: 1 addition & 1 deletion backends/tfhe-cuda-backend/cuda/include/helper_multi_gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extern std::mutex m;
extern bool p2p_enabled;

extern "C" {
int cuda_setup_multi_gpu();
int32_t cuda_setup_multi_gpu();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For curiosity, why do we want to have int32_t instead of int here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure with the types on any architecture, I prefer to always specify the size of the integer (as we do on the Rust side as well).

}

// Define a variant type that can be either a vector or a single pointer
Expand Down
4 changes: 2 additions & 2 deletions backends/tfhe-cuda-backend/cuda/src/utils/helper_multi_gpu.cu
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
std::mutex m;
bool p2p_enabled = false;

int cuda_setup_multi_gpu() {
int32_t cuda_setup_multi_gpu() {
int num_gpus = cuda_get_number_of_gpus();
if (num_gpus == 0)
PANIC("GPU error: the number of GPUs should be > 0.")
Expand All @@ -32,7 +32,7 @@ int cuda_setup_multi_gpu() {
}
m.unlock();
}
return num_used_gpus;
return (int32_t)(num_used_gpus);
}

int get_active_gpu_count(int num_inputs, int gpu_count) {
Expand Down
Loading
Loading