38 DeviceOnly<unsigned int>*
nodes;
55 template <
typename Type>
63 struct cudaDeviceProp dev;
65 check_cuda(cudaGetDevice(&device));
68 check_cuda(cudaGetDeviceCount(&count));
70 fprintf(stderr,
"Error: Out-of-range GPU %d specified (%d total GPUs)",
74 check_cuda(cudaSetDevice(device));
77 check_cuda(cudaGetDeviceProperties(&dev, device));
78 printf(
"[%d] Using GPU %d: %s\n", ctx->
id, device, dev.name);
88 assert(ctx->
id == g.
id);
94 printf(
"[%d] Host memory for graph: %3u MB\n", ctx->
id, mem_usage / 1048756);
103 graph.copy_to_gpu(ctx->
gg);
105 size_t max_shared_size = 0;
107 (
unsigned int*)calloc(num_hosts,
sizeof(
unsigned int));
109 sizeof(
unsigned int) * num_hosts);
110 ctx->
master.
nodes = (DeviceOnly<unsigned int>*)calloc(
111 num_hosts,
sizeof(Shared<unsigned int>));
112 for (uint32_t h = 0; h < num_hosts; ++h) {
123 (
unsigned int*)calloc(num_hosts,
sizeof(
unsigned int));
125 sizeof(
unsigned int) * num_hosts);
126 ctx->
mirror.
nodes = (DeviceOnly<unsigned int>*)calloc(
127 num_hosts,
sizeof(Shared<unsigned int>));
128 for (uint32_t h = 0; h < num_hosts; ++h) {
138 ctx->
offsets.alloc(max_shared_size);
140 ctx->
is_updated.cpu_wr_ptr()->alloc(max_shared_size);
146 size_t mem_usage = 0;
147 size_t max_shared_size = 0;
148 mem_usage += num_hosts *
sizeof(
unsigned int);
149 mem_usage += num_hosts *
sizeof(Shared<unsigned int>);
150 for (uint32_t h = 0; h < num_hosts; ++h) {
158 mem_usage += num_hosts *
sizeof(
unsigned int);
159 mem_usage += num_hosts *
sizeof(Shared<unsigned int>);
160 for (uint32_t h = 0; h < num_hosts; ++h) {
168 mem_usage += max_shared_size *
sizeof(
unsigned int);
169 mem_usage += ((max_shared_size + 63) / 64) *
sizeof(
unsigned long long int);
173 template <
typename Type>
176 unsigned num_hosts) {
177 field->
data.alloc(ctx->
gg.nnodes);
178 size_t max_shared_size = 0;
179 for (uint32_t h = 0; h < num_hosts; ++h) {
184 for (uint32_t h = 0; h < num_hosts; ++h) {
194 template <
typename Type>
197 size_t mem_usage = 0;
198 mem_usage += g.
nnodes *
sizeof(Type);
199 size_t max_shared_size = 0;
200 for (uint32_t h = 0; h < num_hosts; ++h) {
205 for (uint32_t h = 0; h < num_hosts; ++h) {
210 mem_usage += max_shared_size *
sizeof(Type);
211 mem_usage += ((g.
nnodes + 63) / 64) *
sizeof(
unsigned long long int);
Contains forward declarations and the definition of the MarshalGraph class, which is used to marshal ...
struct CUDA_Context_Shared mirror
Definition: libgluon/include/galois/cuda/Context.h:50
bool init_CUDA_context_common(struct CUDA_Context_Common *ctx, int device)
Definition: libgluon/include/galois/cuda/Context.h:62
unsigned int numOwned
Definition: libgluon/include/galois/cuda/Context.h:44
Shared< DynamicBitset > is_updated
Definition: libgluon/include/galois/cuda/Context.h:52
unsigned int numNodesWithEdges
Definition: libgluon/include/galois/cuda/Context.h:46
DeviceOnly< Type > shared_data
Definition: libgluon/include/galois/cuda/Context.h:59
unsigned int index_type
Definition: EdgeHostDecls.h:33
unsigned int * num_mirror_nodes
Definition: HostDecls.h:53
unsigned int numNodesWithEdges
Definition: HostDecls.h:43
Shared< DynamicBitset > is_updated
Definition: libgluon/include/galois/cuda/Context.h:58
Definition: libgluon/include/galois/cuda/Context.h:56
unsigned int beginMaster
Definition: libgluon/include/galois/cuda/Context.h:45
void load_graph_CUDA_field(struct CUDA_Context_Common *ctx, struct CUDA_Context_Field< Type > *field, unsigned num_hosts)
Definition: libgluon/include/galois/cuda/Context.h:174
unsigned int numOwned
Definition: HostDecls.h:41
size_t mem_usage_CUDA_common(MarshalGraph &g, unsigned num_hosts)
Definition: libgluon/include/galois/cuda/Context.h:145
edge_data_type * edge_data
Definition: HostDecls.h:50
Definition: libgluon/include/galois/cuda/Context.h:36
void load_graph_CUDA_common(struct CUDA_Context_Common *ctx, MarshalGraph &g, unsigned num_hosts)
Definition: libgluon/include/galois/cuda/Context.h:82
size_t mem_usage_CUDA_field(struct CUDA_Context_Field< Type > *field, MarshalGraph &g, unsigned num_hosts)
Definition: libgluon/include/galois/cuda/Context.h:195
int id
Definition: libgluon/include/galois/cuda/Context.h:43
Definition: libgluon/include/galois/cuda/Context.h:41
size_t nnodes
Definition: HostDecls.h:39
unsigned int * num_master_nodes
Definition: HostDecls.h:51
int id
Definition: HostDecls.h:45
index_type * edge_dst
Definition: HostDecls.h:48
unsigned int ** master_nodes
Definition: HostDecls.h:52
int device
Definition: libgluon/include/galois/cuda/Context.h:42
unsigned int node_data_type
Definition: EdgeHostDecls.h:34
unsigned int * num_nodes
Definition: libgluon/include/galois/cuda/Context.h:37
Shared< Type > data
Definition: libgluon/include/galois/cuda/Context.h:57
index_type * row_start
Definition: HostDecls.h:47
DeviceOnly< unsigned int > offsets
Definition: libgluon/include/galois/cuda/Context.h:51
Definition: HostDecls.h:38
CSRGraphTy gg
Definition: libgluon/include/galois/cuda/Context.h:48
unsigned edge_data_type
Definition: EdgeHostDecls.h:35
size_t nedges
Definition: HostDecls.h:40
unsigned int beginMaster
Definition: HostDecls.h:42
unsigned int ** mirror_nodes
Definition: HostDecls.h:54
node_data_type * node_data
Definition: HostDecls.h:49
struct CUDA_Context_Shared master
Definition: libgluon/include/galois/cuda/Context.h:49
DeviceOnly< unsigned int > * nodes
Definition: libgluon/include/galois/cuda/Context.h:38