Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat t1005.cu
- #include <iostream>
- struct Thing {
- bool is_solid;
- double matrix[9];
- };
- int main(){
- Thing *things;
- int num_of_things = 100;
- cudaError_t ret = cudaMallocManaged((void **)&things, num_of_things * sizeof(Thing));
- if (ret != cudaSuccess) {
- std::cout << cudaGetErrorString(ret) << std::endl;
- return 1;}
- else {
- things[10].is_solid = true;
- std::cout << "Success!" << std::endl;
- return 0;}
- }
- $ nvcc -arch=sm_30 -o t1005 t1005.cu
- $ ./t1005
- Success!
- $
Add Comment
Please, Sign In to add comment