Skip to content

Instantly share code, notes, and snippets.

@PatWie
Created December 1, 2017 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatWie/d5141efcaaa47c2213639c96dc5504e9 to your computer and use it in GitHub Desktop.
Save PatWie/d5141efcaaa47c2213639c96dc5504e9 to your computer and use it in GitHub Desktop.
test nvidia-smi
// compile me by nvcc copy.cu -o test
#include <iostream>
int main(int argc, char const *argv[])
{
const size_t MB = 10;
const size_t len = MB*256;
float *d_ptr, *h_ptr;
h_ptr = new float[len];
cudaMalloc(&d_ptr, len*sizeof(float));
for (int i = 0; i < 150000000; ++i)
{
cudaMemcpy(d_ptr, h_ptr, len*sizeof(float), cudaMemcpyHostToDevice);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment