Device limits#

Defined in code/simulator.h.

This page documents 3 symbols: 1 enums, 2 functions.

Enums#

Signature

Description

Availability

Location

Example

enum cudaLimit

sim only

simulator.h:2450

Functions#

Signature

Description

Availability

Location

Example

inline cudaError_t cudaDeviceGetLimit(size_t* value, cudaLimit )

sim only

simulator.h:2459

inline cudaError_t cudaDeviceSetLimit(cudaLimit , size_t )

sim only

simulator.h:2458

View

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.

cudaDeviceSetLimit (test_web_pk_quicksort.cu:124)
114    std::mt19937 rng(2047u);
115    std::uniform_int_distribution<unsigned int> dist(0, num_items - 1);
116    for (int i = 0; i < num_items; ++i) h_data[i] = dist(rng);
117
118    unsigned int* d_data = nullptr;
119    check(cudaMalloc(reinterpret_cast<void**>(&d_data), num_items * sizeof(unsigned int)),
120          "cudaMalloc");
121    check(cudaMemcpy(d_data, h_data.data(), num_items * sizeof(unsigned int),
122                     cudaMemcpyHostToDevice), "cudaMemcpy H2D");
123
124    check(cudaDeviceSetLimit(cudaLimitDevRuntimeSyncDepth, MAX_DEPTH), "cudaDeviceSetLimit");
125
126    std::printf("Running quicksort on %d elements\n", num_items);
127    LAUNCH(cdp_simple_quicksort, 1, 1, d_data, 0, num_items - 1, 0);
128    check(cudaDeviceSynchronize(), "cudaDeviceSynchronize");
129
130    std::vector<unsigned int> results(num_items);
131    check(cudaMemcpy(results.data(), d_data, num_items * sizeof(unsigned int),
132                     cudaMemcpyDeviceToHost), "cudaMemcpy D2H");
133
134    // Reference: the same multiset, sorted.
135    std::vector<unsigned int> expect = h_data;