api_cuda_triangles Last update: 17.07.2025 1#pragma once 2 3#include <rocky20/api/device/api_device_triangles.hpp> 4#include <rocky20/api/device/api_cuda.hpp> 5 6namespace rocky::cuda 7{ 8 9template <typename Callable> 10void dispatch_triangles_kernel( 11 IRockyModel &model, 12 Callable h_triangle_f_ptr, 13 void **udf_devices_data 14) 15{ 16 if (model.get_number_of_active_triangles() <= 0) 17 return; 18 19 for (int i=0; i<model.get_number_of_devices(); i++) 20 { 21 CUDA_SET_DEVICE(model.get_device_id(i)); 22 23 void *udf_device_data = udf_devices_data[i]; 24 device::execute_triangles_function<CudaBackend><<<CD_NBLOCKS, CD_NTHREADS>>>( 25 model.get_device_data(i), model.get_current_time(), 26 h_triangle_f_ptr, udf_device_data 27 ); 28 } 29 30 // Sync all GPUs 31 sync_devices(model); 32} 33 34} // namespace rocky::cuda IRockyModelDefinition rocky_api.h:60 IRockyModel::get_number_of_devicesint get_number_of_devices() constDefinition rocky_api.cpp:159 IRockyModel::get_number_of_active_trianglesint get_number_of_active_triangles()Definition rocky_api.cpp:144 IRockyModel::get_current_timedouble get_current_time() constDefinition rocky_api.cpp:129 IRockyModel::get_device_idint get_device_id(int device_index) constDefinition rocky_api.cpp:164