Symbols, device flags, versions, choose-device#
Defined in code/simulator.h.
This page documents 8 symbols: 8 functions.
Functions#
Signature |
Description |
Availability |
Location |
Example |
|---|---|---|---|---|
|
sim only |
simulator.h:2275 |
||
|
sim only |
simulator.h:2273 |
||
|
sim only |
simulator.h:2272 |
||
|
sim only |
simulator.h:2269 |
||
|
sim only |
simulator.h:2270 |
||
|
sim only |
simulator.h:2276 |
||
|
sim only |
simulator.h:2274 |
||
|
sim only |
simulator.h:2271 |
Examples#
Code from the repository’s example corpus (code\*.cu); the highlighted line is the call site. These blocks are what the View links above open.
cudaGetSymbolAddress (test_web_enccs_reduce_static.cu:85)
75 y += g.shfl_down(y, i);
76
77 if (tid == 0)
78 d_y[bid] = y;
79}
80
81// host driver (the cudaEvent timing loop is dropped; runs the two passes once)
82static real reduce(const real *d_x)
83{
84 real *d_y;
85 CHECK(cudaMalloc(&d_y, sizeof(real) * GRID_SIZE)); // [SIM] was: cudaGetSymbolAddress(static_y)
86
87 const int smem = sizeof(real) * BLOCK_SIZE;
88 LAUNCH_DYN(reduce_cp, GRID_SIZE, BLOCK_SIZE, smem, d_x, d_y, NX); // [SIM]
89 LAUNCH_DYN(reduce_cp, 1, 1024, sizeof(real) * 1024, d_y, d_y, GRID_SIZE); // [SIM]
90
91 real h_y[1] = {0};
92 CHECK(cudaMemcpy(h_y, d_y, sizeof(real), cudaMemcpyDeviceToHost));
93 CHECK(cudaFree(d_y));
94 return h_y[0];
95}
cudaSetDeviceFlags (test_web_eeg_mapped.cu:111)
101 }
102 cudaDeviceProp prop{}; cudaGetDeviceProperties(&prop, 0);
103 std::printf("Device 0: %s (compute %d.%d)\n", prop.name, prop.major, prop.minor);
104
105 Vector<float> h_a, h_b;
106 h_a.length = FULL_DATA_SIZE;
107 h_b.length = FULL_DATA_SIZE;
108
109 // allocate pinned host memory accessible by the device
110#ifdef __CUDACC__
111 cudaSetDeviceFlags(cudaDeviceMapHost);
112 cudaHostAlloc((void**)&h_a.elements, FULL_ARRAY_BYTES,
113 cudaHostAllocWriteCombined | cudaHostAllocMapped);
114 cudaHostAlloc((void**)&h_b.elements, FULL_ARRAY_BYTES,
115 cudaHostAllocWriteCombined | cudaHostAllocMapped);
116#else
117 cudaHostAlloc((void**)&h_a.elements, FULL_ARRAY_BYTES); // [SIM] plain pinned alloc
118 cudaHostAlloc((void**)&h_b.elements, FULL_ARRAY_BYTES);
119#endif
120
121 for (int i = 0; i < FULL_DATA_SIZE; i++) {
122 h_a.setElement(i, 1.0f);