-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (26 loc) · 953 Bytes
/
main.cpp
File metadata and controls
36 lines (26 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "framework.h"
#include <ctime>
#include <cstdlib>
void callKernels(int blocks_per_grid, int max_threads, double deltaTime,
glm::mat4* models, Shoal* shoal, struct cudaArrays soa)
{
calculateGridKernel<<<blocks_per_grid, max_threads>>>(soa, shoal->behaviourParams.visibility_radius);
gpuErrchk(cudaPeekAtLastError());
gpuErrchk(cudaDeviceSynchronize());
thrust::sort_by_key(thrust::device, soa.grid_cells, soa.grid_cells + Application::N, soa.grid_boids);
gpuErrchk(cudaPeekAtLastError());
gpuErrchk(cudaDeviceSynchronize());
calculateGridStartsKernel<<<blocks_per_grid, max_threads>>>(soa);
gpuErrchk(cudaPeekAtLastError());
gpuErrchk(cudaDeviceSynchronize());
calculateBoidsKernel<<<blocks_per_grid, max_threads>>>(soa, shoal->behaviourParams,
deltaTime, models);
gpuErrchk(cudaPeekAtLastError());
gpuErrchk(cudaDeviceSynchronize());
}
int main()
{
Application* app = new Application();
app->run();
return 0;
}