This repository has been archived by the owner on Nov 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial support of distributed sampling (#171)
This PR introduces support for distributed graph sampling (via NCCL backend). The initial implementation focuses on the uniform neighbor sampler. We are going to extend it to support other samplers in future. Highlights: - Distributed Graph Storage: Now, the graph structure (represented by `row_ptr` and `col_indx` tensors) can be stored as wholememory arrays in a distributed fashion with even distribution across ranks (support both `cpu` and `cuda` storage type). - Distributed Sampling: The sampling process leverages the existing wholegraph gather function to collect the sampled nodes and edges across all ranks. - Uniform Neighbor Sampler Support: Currently, only the uniform neighbor sampler is supported. cc. @linhu-nv @dongxuy04 @BradReesWork @nvcastet @TristonC Authors: - Chang Liu (https://github.com/chang-l) Approvers: - https://github.com/linhu-nv - Brad Rees (https://github.com/BradReesWork) URL: #171
- Loading branch information
Showing
8 changed files
with
566 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
cpp/src/wholegraph_ops/unweighted_sample_without_replacement_impl_nccl.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright (c) 2019-2024, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include <cuda_runtime_api.h> | ||
|
||
#include <wholememory/env_func_ptrs.h> | ||
#include <wholememory/wholememory.h> | ||
|
||
#include "unweighted_sample_without_replacement_nccl_func.cuh" | ||
#include "wholememory_ops/register.hpp" | ||
|
||
namespace wholegraph_ops { | ||
|
||
REGISTER_DISPATCH_TWO_TYPES(UnweightedSampleWithoutReplacementCSRNCCL, | ||
wholegraph_csr_unweighted_sample_without_replacement_nccl_func, | ||
SINT3264, | ||
SINT3264) | ||
|
||
wholememory_error_code_t wholegraph_csr_unweighted_sample_without_replacement_nccl( | ||
wholememory_handle_t csr_row_wholememory_handle, | ||
wholememory_handle_t csr_col_wholememory_handle, | ||
wholememory_tensor_description_t wm_csr_row_ptr_desc, | ||
wholememory_tensor_description_t wm_csr_col_ptr_desc, | ||
void* center_nodes, | ||
wholememory_array_description_t center_nodes_desc, | ||
int max_sample_count, | ||
void* output_sample_offset, | ||
wholememory_array_description_t output_sample_offset_desc, | ||
void* output_dest_memory_context, | ||
void* output_center_localid_memory_context, | ||
void* output_edge_gid_memory_context, | ||
unsigned long long random_seed, | ||
wholememory_env_func_t* p_env_fns, | ||
cudaStream_t stream) | ||
{ | ||
try { | ||
DISPATCH_TWO_TYPES(center_nodes_desc.dtype, | ||
wm_csr_col_ptr_desc.dtype, | ||
UnweightedSampleWithoutReplacementCSRNCCL, | ||
csr_row_wholememory_handle, | ||
csr_col_wholememory_handle, | ||
wm_csr_row_ptr_desc, | ||
wm_csr_col_ptr_desc, | ||
center_nodes, | ||
center_nodes_desc, | ||
max_sample_count, | ||
output_sample_offset, | ||
output_sample_offset_desc, | ||
output_dest_memory_context, | ||
output_center_localid_memory_context, | ||
output_edge_gid_memory_context, | ||
random_seed, | ||
p_env_fns, | ||
stream); | ||
|
||
} catch (const wholememory::cuda_error& rle) { | ||
// WHOLEMEMORY_FAIL_NOTHROW("%s", rle.what()); | ||
return WHOLEMEMORY_LOGIC_ERROR; | ||
} catch (const wholememory::logic_error& le) { | ||
return WHOLEMEMORY_LOGIC_ERROR; | ||
} catch (...) { | ||
return WHOLEMEMORY_LOGIC_ERROR; | ||
} | ||
return WHOLEMEMORY_SUCCESS; | ||
} | ||
|
||
} // namespace wholegraph_ops |
Oops, something went wrong.