38 DeviceOnly<unsigned int>*
edges;
55 template <
typename Type>
64 struct cudaDeviceProp dev;
66 check_cuda(cudaGetDevice(&device));
69 check_cuda(cudaGetDeviceCount(&count));
71 fprintf(stderr,
"Error: Out-of-range GPU %d specified (%d total GPUs)",
75 check_cuda(cudaSetDevice(device));
78 check_cuda(cudaGetDeviceProperties(&dev, device));
79 printf(
"[%d] Using GPU %d: %s\n", ctx->
id, device, dev.name);
85 bool LoadProxyEdges =
true) {
90 assert(ctx->
id == g.
id);
96 printf(
"[%d] Host memory for graph: %3u MB\n", ctx->
id, mem_usage / 1048756);
105 graph.copy_to_gpu(ctx->
gg);
107 if (LoadProxyEdges) {
108 size_t max_shared_size = 0;
110 (
unsigned int*)calloc(num_hosts,
sizeof(
unsigned int));
112 sizeof(
unsigned int) * num_hosts);
113 ctx->
master.
edges = (DeviceOnly<unsigned int>*)calloc(
114 num_hosts,
sizeof(Shared<unsigned int>));
115 for (uint32_t h = 0; h < num_hosts; ++h) {
126 (
unsigned int*)calloc(num_hosts,
sizeof(
unsigned int));
128 sizeof(
unsigned int) * num_hosts);
129 ctx->
mirror.
edges = (DeviceOnly<unsigned int>*)calloc(
130 num_hosts,
sizeof(Shared<unsigned int>));
131 for (uint32_t h = 0; h < num_hosts; ++h) {
141 ctx->
offsets.alloc(max_shared_size);
143 ctx->
is_updated.cpu_wr_ptr()->alloc(max_shared_size);
150 size_t mem_usage = 0;
151 size_t max_shared_size = 0;
152 mem_usage += num_hosts *
sizeof(
unsigned int);
153 mem_usage += num_hosts *
sizeof(Shared<unsigned int>);
154 for (uint32_t h = 0; h < num_hosts; ++h) {
162 mem_usage += num_hosts *
sizeof(
unsigned int);
163 mem_usage += num_hosts *
sizeof(Shared<unsigned int>);
164 for (uint32_t h = 0; h < num_hosts; ++h) {
172 mem_usage += max_shared_size *
sizeof(
unsigned int);
173 mem_usage += ((max_shared_size + 63) / 64) *
sizeof(
unsigned long long int);
177 template <
typename Type>
180 unsigned num_hosts) {
181 field->
data.alloc(ctx->
gg.nedges);
182 size_t max_shared_size = 0;
183 for (uint32_t h = 0; h < num_hosts; ++h) {
188 for (uint32_t h = 0; h < num_hosts; ++h) {
198 template <
typename Type>
201 size_t mem_usage = 0;
202 mem_usage += g.
nedges *
sizeof(Type);
203 size_t max_shared_size = 0;
204 for (uint32_t h = 0; h < num_hosts; ++h) {
209 for (uint32_t h = 0; h < num_hosts; ++h) {
214 mem_usage += max_shared_size *
sizeof(Type);
215 mem_usage += ((g.
nedges + 63) / 64) *
sizeof(
unsigned long long int);
void load_graph_CUDA_common_edges(struct CUDA_Context_Common_Edges *ctx, EdgeMarshalGraph &g, unsigned num_hosts, bool LoadProxyEdges=true)
Definition: EdgeContext.h:83
unsigned int * num_master_edges
Definition: EdgeHostDecls.h:51
unsigned int numNodesWithEdges
Definition: EdgeContext.h:46
size_t nedges
Definition: EdgeHostDecls.h:40
unsigned int numOwned
Definition: EdgeHostDecls.h:41
unsigned int ** mirror_edges
Definition: EdgeHostDecls.h:54
unsigned int ** master_edges
Definition: EdgeHostDecls.h:52
index_type * row_start
Definition: EdgeHostDecls.h:47
Shared< Type > data
Definition: EdgeContext.h:57
DeviceOnly< Type > shared_data
Definition: EdgeContext.h:59
Definition: EdgeContext.h:36
unsigned int index_type
Definition: EdgeHostDecls.h:33
Contains forward declarations and the definition of the EdgeMarshalGraph class, which is used to mars...
Definition: EdgeContext.h:56
unsigned int numNodesWithEdges
Definition: EdgeHostDecls.h:43
struct CUDA_Context_Shared_Edges mirror
Definition: EdgeContext.h:50
int id
Definition: EdgeHostDecls.h:45
size_t mem_usage_CUDA_common_edges(EdgeMarshalGraph &g, unsigned num_hosts)
Definition: EdgeContext.h:149
unsigned int * num_mirror_edges
Definition: EdgeHostDecls.h:53
unsigned int beginMaster
Definition: EdgeContext.h:45
Shared< DynamicBitset > is_updated
Definition: EdgeContext.h:52
node_data_type * node_data
Definition: EdgeHostDecls.h:49
int device
Definition: EdgeContext.h:42
DeviceOnly< unsigned int > offsets
Definition: EdgeContext.h:51
unsigned int * num_edges
Definition: EdgeContext.h:37
void load_graph_CUDA_field_edges(struct CUDA_Context_Common_Edges *ctx, struct CUDA_Context_Field_Edges< Type > *field, unsigned num_hosts)
Definition: EdgeContext.h:178
unsigned int beginMaster
Definition: EdgeHostDecls.h:42
index_type * edge_dst
Definition: EdgeHostDecls.h:48
unsigned int numOwned
Definition: EdgeContext.h:44
CSRGraphTy gg
Definition: EdgeContext.h:48
struct CUDA_Context_Shared_Edges master
Definition: EdgeContext.h:49
unsigned int node_data_type
Definition: EdgeHostDecls.h:34
size_t nnodes
Definition: EdgeHostDecls.h:39
size_t mem_usage_CUDA_field_edges(struct CUDA_Context_Field_Edges< Type > *field, EdgeMarshalGraph &g, unsigned num_hosts)
Definition: EdgeContext.h:199
DeviceOnly< unsigned int > * edges
Definition: EdgeContext.h:38
bool init_CUDA_context_common_edges(struct CUDA_Context_Common_Edges *ctx, int device)
Definition: EdgeContext.h:62
Definition: EdgeContext.h:41
int id
Definition: EdgeContext.h:43
edge_data_type * edge_data
Definition: EdgeHostDecls.h:50
unsigned edge_data_type
Definition: EdgeHostDecls.h:35
Definition: EdgeHostDecls.h:38
Shared< DynamicBitset > is_updated
Definition: EdgeContext.h:58