Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, char* argv[])
- {
- init_all(argc, argv);
- system("PAUSE");
- return 0;
- }
- void init_all(int argc, char* argv[])
- {
- check_cuda_info();
- if (!glfwInit())
- {
- std::cout << "[Info]Failed to initialize GLFW!" << std::endl;
- return;
- }
- if (!init_config())
- {
- return;
- }
- //....Other initialization work
- }
- void check_cuda_info()
- {
- int device_count;
- CUDA_CALL((cudaGetDeviceCount(&device_count)));
- for (auto i = 0; i < device_count; i++)
- {
- CUDA_CALL(cudaGetDeviceProperties(cuda_prop, i));
- //Print device information
- if (cuda_prop->major > 6)
- {
- CUDA_CALL(cudaSetDevice(i));
- break;
- }
- }
- }
- CUDA_CALL(cudaMallocManaged((void**)&m_config_device, sizeof(configuration)));
- m_config_device->width = m_width; //(1)<===============CRASH HERE
- m_config_device->height = m_height;
- m_config_device->use_fullscreen = m_use_fullscreen;
- m_config_device->block_size = m_block_size;
- m_config_device->max_block_size = m_max_block_size;
- m_config_device->max_tracer_depth = m_max_tracer_depth;
- m_config_device->vector_bias_length = m_vector_bias_length;
- m_config_device->energy_exist_threshold = m_energy_exist_threshold;
- m_config_device->sss_threshold = m_sss_threshold;
- m_config_device->use_sky_box = m_use_sky_box;
- m_config_device->use_bilinear = m_use_bilinear;
- m_config_device->use_ground = m_use_ground;
- struct configuration
- {
- int width;
- int height;
- bool use_fullscreen;
- int block_size;
- int max_block_size;
- int max_tracer_depth;
- float vector_bias_length;
- float energy_exist_threshold;
- float sss_threshold;
- bool use_sky_box;
- bool use_ground;
- bool use_bilinear;
- };
Add Comment
Please, Sign In to add comment