Skip to content

Commit 8543915

Browse files
authored
Merge pull request #78 from oneapi-src/gr/code_update/2411
[SeisAcoMod2D][hashtable][tsne] updates
2 parents b22215c + eb417c7 commit 8543915

File tree

5 files changed

+28
-10
lines changed

5 files changed

+28
-10
lines changed

SeisAcoMod2D/common/modelling.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ typedef struct ModelInfo
4343

4444
float **vel2d, **rho2d; // 2D array to store velocity and density model
4545
float vmax, vmin;
46-
46+
ModelInfo() {
47+
memset(velfile, 0, 224);
48+
memset(densfile, 0, 224);
49+
}
4750
}mod_t;
4851

4952
typedef struct Wavelet

hashtable/CUDA/src/main.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
// #define DEBUG_TIME
2323
#define CPP_MODULE "MAIN"
24+
#define ITERATIONS 10
2425

2526
#define TIMER_START() time_start = std::chrono::steady_clock::now();
2627
#define TIMER_END() \
@@ -170,7 +171,11 @@ START_TIMER();
170171
#ifdef DEBUG_TIME
171172
STOP_TIMER();
172173
PRINT_TIMER("init ");
174+
#endif
173175

176+
std::vector<KeyValue> kvs;
177+
for (int iter = 0; iter < ITERATIONS; iter++){
178+
#ifdef DEBUG_TIME
174179
START_TIMER();
175180
#endif
176181
// Allocates device memory for the hashtable and
@@ -231,7 +236,7 @@ PRINT_TIMER("delete_hashtable ");
231236
START_TIMER();
232237
#endif
233238
// Get all the key-values from the hash table
234-
std::vector<KeyValue> kvs = iterate_hashtable(pHashTable);
239+
kvs = iterate_hashtable(pHashTable);
235240
#ifdef DEBUG_TIME
236241
STOP_TIMER();
237242
PRINT_TIMER("iterate_hashtable ");
@@ -244,9 +249,10 @@ PRINT_TIMER("iterate_hashtable ");
244249

245250
destroy_hashtable(pHashTable);
246251

252+
}
247253
TIMER_END()
248254
TIMER_PRINT("hashtable - total time for whole calculation")
249-
printf("%f million keys/second\n", kNumKeyValues / (time_total / 1000.0f) / 1000000.0f);
255+
printf("%f million keys/second\n", kNumKeyValues / (time_total / ITERATIONS / 1000.0f) / 1000000.0f);
250256

251257
bool verify = true;
252258
if (argc > 1 && strcmp(argv[1], "--no-verify") == 0) {

hashtable/HIP/src/main.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
// #define DEBUG_TIME
2323
#define CPP_MODULE "MAIN"
24+
#define ITERATIONS 10
2425

2526
#define TIMER_START() time_start = std::chrono::steady_clock::now();
2627
#define TIMER_END() \
@@ -170,7 +171,11 @@ START_TIMER();
170171
#ifdef DEBUG_TIME
171172
STOP_TIMER();
172173
PRINT_TIMER("init ");
174+
#endif
173175

176+
std::vector<KeyValue> kvs;
177+
for (int iter = 0; iter < ITERATIONS; iter++){
178+
#ifdef DEBUG_TIME
174179
START_TIMER();
175180
#endif
176181
// Allocates device memory for the hashtable and
@@ -231,7 +236,7 @@ PRINT_TIMER("delete_hashtable ");
231236
START_TIMER();
232237
#endif
233238
// Get all the key-values from the hash table
234-
std::vector<KeyValue> kvs = iterate_hashtable(pHashTable);
239+
kvs = iterate_hashtable(pHashTable);
235240
#ifdef DEBUG_TIME
236241
STOP_TIMER();
237242
PRINT_TIMER("iterate_hashtable ");
@@ -243,10 +248,10 @@ PRINT_TIMER("iterate_hashtable ");
243248
// seconds = milliseconds / 1000.0f;
244249

245250
destroy_hashtable(pHashTable);
246-
251+
}
247252
TIMER_END()
248253
TIMER_PRINT("hashtable - total time for whole calculation")
249-
printf("%f million keys/second\n", kNumKeyValues / (time_total / 1000.0f) / 1000000.0f);
254+
printf("%f million keys/second\n", kNumKeyValues / (time_total / ITERATIONS / 1000.0f) / 1000000.0f);
250255

251256
bool verify = true;
252257
if (argc > 1 && strcmp(argv[1], "--no-verify") == 0) {

hashtable/SYCL/src/main.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
// #define DEBUG_TIME
2323
#define CPP_MODULE "MAIN"
24+
#define ITERATIONS 10
2425

2526
#define TIMER_START() time_start = std::chrono::steady_clock::now();
2627
#define TIMER_END() \
@@ -169,7 +170,11 @@ START_TIMER();
169170
#ifdef DEBUG_TIME
170171
STOP_TIMER();
171172
PRINT_TIMER("init ");
173+
#endif
172174

175+
std::vector<KeyValue> kvs;
176+
for (int iter = 0; iter < ITERATIONS; iter++) {
177+
#ifdef DEBUG_TIME
173178
START_TIMER();
174179
#endif
175180
// Allocates device memory for the hashtable and
@@ -233,7 +238,7 @@ PRINT_TIMER("delete_hashtable ");
233238
START_TIMER();
234239
#endif
235240
// Get all the key-values from the hash table
236-
std::vector<KeyValue> kvs = iterate_hashtable(pHashTable, qht);
241+
kvs = iterate_hashtable(pHashTable, qht);
237242
#ifdef DEBUG_TIME
238243
STOP_TIMER();
239244
PRINT_TIMER("iterate_hashtable ");
@@ -246,9 +251,10 @@ PRINT_TIMER("iterate_hashtable ");
246251

247252
destroy_hashtable(pHashTable, qht);
248253

254+
}
249255
TIMER_END()
250256
TIMER_PRINT("hashtable - total time for whole calculation")
251-
printf("%f million keys/second\n", kNumKeyValues / (time_total / 1000.0f) / 1000000.0f);
257+
printf("%f million keys/second\n", kNumKeyValues / (time_total / ITERATIONS / 1000.0f) / 1000000.0f);
252258

253259
bool verify = true;
254260
if (argc > 1 && strcmp(argv[1], "--no-verify") == 0) {

tsne/SYCL/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ include_directories(
149149
${CMAKE_SOURCE_DIR}/src/
150150
${CMAKE_SOURCE_DIR}/src/include
151151
${CMAKE_SOURCE_DIR}/../data
152-
/nfs/pdx/home/mgrabban/oneDPL/include
153-
/nfs/pdx/home/mgrabban/oneTBB/include
154152
)
155153

156154
add_executable(tsne ${SOURCES})

0 commit comments

Comments
 (0)