Guest User

Untitled

a guest
Mar 21st, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. int main(int argc, char* argv[])
  2. {
  3. init_all(argc, argv);
  4. system("PAUSE");
  5. return 0;
  6. }
  7.  
  8. void init_all(int argc, char* argv[])
  9. {
  10. check_cuda_info();
  11.  
  12. if (!glfwInit())
  13. {
  14. std::cout << "[Info]Failed to initialize GLFW!" << std::endl;
  15. return;
  16. }
  17.  
  18. if (!init_config())
  19. {
  20. return;
  21. }
  22.  
  23. //....Other initialization work
  24. }
  25.  
  26. void check_cuda_info()
  27. {
  28. int device_count;
  29. CUDA_CALL((cudaGetDeviceCount(&device_count)));
  30.  
  31. for (auto i = 0; i < device_count; i++)
  32. {
  33. CUDA_CALL(cudaGetDeviceProperties(cuda_prop, i));
  34.  
  35. //Print device information
  36.  
  37. if (cuda_prop->major > 6)
  38. {
  39. CUDA_CALL(cudaSetDevice(i));
  40. break;
  41. }
  42. }
  43. }
  44.  
  45. CUDA_CALL(cudaMallocManaged((void**)&m_config_device, sizeof(configuration)));
  46.  
  47. m_config_device->width = m_width; //(1)<===============CRASH HERE
  48. m_config_device->height = m_height;
  49. m_config_device->use_fullscreen = m_use_fullscreen;
  50. m_config_device->block_size = m_block_size;
  51. m_config_device->max_block_size = m_max_block_size;
  52. m_config_device->max_tracer_depth = m_max_tracer_depth;
  53. m_config_device->vector_bias_length = m_vector_bias_length;
  54. m_config_device->energy_exist_threshold = m_energy_exist_threshold;
  55. m_config_device->sss_threshold = m_sss_threshold;
  56. m_config_device->use_sky_box = m_use_sky_box;
  57. m_config_device->use_bilinear = m_use_bilinear;
  58. m_config_device->use_ground = m_use_ground;
  59.  
  60. struct configuration
  61. {
  62. int width;
  63. int height;
  64. bool use_fullscreen;
  65. int block_size;
  66. int max_block_size;
  67. int max_tracer_depth;
  68. float vector_bias_length;
  69. float energy_exist_threshold;
  70. float sss_threshold;
  71. bool use_sky_box;
  72. bool use_ground;
  73. bool use_bilinear;
  74. };
Add Comment
Please, Sign In to add comment