Skip to content

Commit c62d36a

Browse files
committed
Remove JSONs so that all diffs are pushed
1 parent 1e0b3c2 commit c62d36a

File tree

8 files changed

+71
-284758
lines changed

8 files changed

+71
-284758
lines changed

input/corridorWidening.json

Lines changed: 0 additions & 9921 deletions
This file was deleted.

input/evacuateRoom.json

Lines changed: 0 additions & 14787 deletions
This file was deleted.

input/evacuateRoomLarge.json

Lines changed: 0 additions & 214287 deletions
This file was deleted.

input/fourSquare.json

Lines changed: 0 additions & 4512 deletions
This file was deleted.

input/laneFiltering.json

Lines changed: 0 additions & 14871 deletions
This file was deleted.

input/tightCorner.json

Lines changed: 0 additions & 11469 deletions
This file was deleted.

input/twoExitsTwoGroups.json

Lines changed: 0 additions & 14834 deletions
This file was deleted.

src/main.cpp

Lines changed: 71 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
uint GLOBALSEED;
2020

21-
void init(int &SCALE, int &DELAY, SDL_Window *&win, SDL_Renderer *&render,
21+
void init(int &SCALE, int &DELAY,
2222
std::vector<Actor> &actors, Room &room, std::vector<Path> &paths,
2323
int argc, char **argv) {
2424
int WIDTH;
@@ -44,12 +44,6 @@ void init(int &SCALE, int &DELAY, SDL_Window *&win, SDL_Renderer *&render,
4444
actor.setSeed(GLOBALSEED);
4545
}
4646

47-
// Initialise SDL
48-
SDL_Init(SDL_INIT_VIDEO);
49-
win = SDL_CreateWindow("SYCL Crowd Simulation", SDL_WINDOWPOS_UNDEFINED,
50-
SDL_WINDOWPOS_UNDEFINED, WIDTH * SCALE,
51-
HEIGHT * SCALE, SDL_WINDOW_SHOWN);
52-
render = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
5347
}
5448

5549
void drawCircle(SDL_Renderer *&render, SDL_Point center, int radius,
@@ -174,8 +168,8 @@ int main(int argc, char *argv[]) {
174168
int SCALE;
175169
int DELAY;
176170

177-
SDL_Window *win;
178-
SDL_Renderer *render;
171+
// SDL_Window *win;
172+
// SDL_Renderer *render;
179173

180174
std::vector<Actor> actors;
181175
Room room = Room({});
@@ -189,7 +183,7 @@ int main(int argc, char *argv[]) {
189183

190184
sycl::queue myQueue{sycl::gpu_selector(), asyncHandler};
191185

192-
init(SCALE, DELAY, win, render, actors, room, paths, argc, argv);
186+
init(SCALE, DELAY, actors, room, paths, argc, argv);
193187

194188
// Buffer creation
195189
auto actorBuf = sycl::buffer<Actor>(actors.data(), actors.size());
@@ -199,76 +193,76 @@ int main(int argc, char *argv[]) {
199193
auto pathsBuf = sycl::buffer<Path>(paths.data(), paths.size());
200194
pathsBuf.set_final_data(nullptr);
201195

202-
int delayCounter = 0;
203-
int updateBBoxCounter = 0;
204-
bool isQuit = false;
205-
bool isPause = false;
206-
SDL_Event event;
207-
208-
std::vector<int> executionTimes;
209-
210-
while (!isQuit) {
211-
if (SDL_PollEvent(&event)) {
212-
if (event.type == SDL_QUIT) {
213-
isQuit = true;
214-
} else if (event.type == SDL_KEYDOWN &&
215-
event.key.keysym.sym == SDLK_SPACE) {
216-
isPause = !isPause;
217-
}
218-
}
219-
220-
if (!isPause) {
221-
if (delayCounter >= DELAY) {
222-
delayCounter = 0;
223-
auto start = std::chrono::high_resolution_clock::now();
224-
225-
if (updateBBoxCounter <= 0) {
226-
updateBBox(myQueue, actorBuf);
227-
updateBBoxCounter = 20;
228-
}
229-
230-
updateVariations(myQueue, actorBuf);
231-
update(myQueue, actorBuf, wallsBuf, pathsBuf);
232-
233-
auto end = std::chrono::high_resolution_clock::now();
234-
auto duration =
235-
std::chrono::duration_cast<std::chrono::milliseconds>(
236-
end - start);
237-
executionTimes.push_back(duration.count());
238-
// std::cout << "fps: " << (1000.0f / duration.count()) <<
239-
// std::endl;
240-
241-
sycl::host_accessor<Actor, 1, sycl::access::mode::read> actorHostAcc(actorBuf);
242-
243-
draw(SCALE, render, actorHostAcc, room);
244-
updateBBoxCounter--;
245-
} else {
246-
delayCounter++;
247-
}
248-
}
249-
}
196+
// int delayCounter = 0;
197+
// int updateBBoxCounter = 0;
198+
// bool isQuit = false;
199+
// bool isPause = false;
200+
// SDL_Event event;
201+
202+
// std::vector<int> executionTimes;
203+
204+
// while (!isQuit) {
205+
// if (SDL_PollEvent(&event)) {
206+
// if (event.type == SDL_QUIT) {
207+
// isQuit = true;
208+
// } else if (event.type == SDL_KEYDOWN &&
209+
// event.key.keysym.sym == SDLK_SPACE) {
210+
// isPause = !isPause;
211+
// }
212+
// }
250213

251-
executionTimes.erase(executionTimes.begin());
252-
float count = static_cast<float>(executionTimes.size());
253-
float mean =
254-
std::accumulate(executionTimes.begin(), executionTimes.end(), 0.0) /
255-
count;
256-
std::cout << "Mean execution time: " << mean << std::endl;
257-
258-
close(win, render);
259-
260-
// // For Profiling
261-
// int updateBBoxCounterr = 0;
262-
// for (int x = 0; x < 500; x++) {
263-
// if (updateBBoxCounterr <= 0) {
264-
// updateBBox(myQueue, actorBuf);
265-
// updateBBoxCounterr = 20;
214+
// if (!isPause) {
215+
// if (delayCounter >= DELAY) {
216+
// delayCounter = 0;
217+
// auto start = std::chrono::high_resolution_clock::now();
218+
219+
// if (updateBBoxCounter <= 0) {
220+
// updateBBox(myQueue, actorBuf);
221+
// updateBBoxCounter = 20;
222+
// }
223+
224+
// updateVariations(myQueue, actorBuf);
225+
// update(myQueue, actorBuf, wallsBuf, pathsBuf);
226+
227+
// auto end = std::chrono::high_resolution_clock::now();
228+
// auto duration =
229+
// std::chrono::duration_cast<std::chrono::milliseconds>(
230+
// end - start);
231+
// executionTimes.push_back(duration.count());
232+
// // std::cout << "fps: " << (1000.0f / duration.count()) <<
233+
// // std::endl;
234+
235+
// sycl::host_accessor<Actor, 1, sycl::access::mode::read> actorHostAcc(actorBuf);
236+
237+
// draw(SCALE, render, actorHostAcc, room);
238+
// updateBBoxCounter--;
239+
// } else {
240+
// delayCounter++;
241+
// }
266242
// }
267-
// updateVariations(myQueue, actorBuf);
268-
// update(myQueue, actorBuf, wallsBuf, pathsBuf);
269-
// sycl::host_accessor<Actor, 1, sycl::access::mode::read> actorHostAcc(actorBuf);
270-
// updateBBoxCounterr--;
271243
// }
272244

245+
// executionTimes.erase(executionTimes.begin());
246+
// float count = static_cast<float>(executionTimes.size());
247+
// float mean =
248+
// std::accumulate(executionTimes.begin(), executionTimes.end(), 0.0) /
249+
// count;
250+
// std::cout << "Mean execution time: " << mean << std::endl;
251+
252+
// close(win, render);
253+
254+
// For Profiling
255+
int updateBBoxCounterr = 0;
256+
for (int x = 0; x < 500; x++) {
257+
if (updateBBoxCounterr <= 0) {
258+
updateBBox(myQueue, actorBuf);
259+
updateBBoxCounterr = 20;
260+
}
261+
updateVariations(myQueue, actorBuf);
262+
update(myQueue, actorBuf, wallsBuf, pathsBuf);
263+
sycl::host_accessor<Actor, 1, sycl::access::mode::read> actorHostAcc(actorBuf);
264+
updateBBoxCounterr--;
265+
}
266+
273267
return 0;
274268
}

0 commit comments

Comments
 (0)