File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11include_directories (${CMAKE_SOURCE_DIR} )
22add_executable (thdat thdat.c )
3+ find_package (OpenMP )
4+ if (OPENMP_FOUND)
5+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} " )
6+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} " )
7+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS} " )
8+ endif ()
39target_link_libraries (thdat thtk util )
410link_setargv (thdat )
511install (TARGETS thdat DESTINATION bin)
Original file line number Diff line number Diff line change @@ -263,8 +263,9 @@ thdat_create_wrapper(
263263
264264 k = 0 ;
265265 /* TODO: Properly indicate when insertion fails. */
266- #pragma omp parallel for
267- for (size_t i = 0 ; i < real_entry_count ; ++ i ) {
266+ ssize_t i ;
267+ #pragma omp parallel for schedule(dynamic)
268+ for (i = 0 ; i < real_entry_count ; ++ i ) {
268269 thtk_error_t * error = NULL ;
269270 thtk_io_t * entry_stream ;
270271 off_t entry_size ;
@@ -373,8 +374,9 @@ main(
373374 }
374375
375376 if (argc > 3 ) {
376- #pragma omp parallel for
377- for (int a = 3 ; a < argc ; ++ a ) {
377+ ssize_t a ;
378+ #pragma omp parallel for schedule(dynamic)
379+ for (a = 3 ; a < argc ; ++ a ) {
378380 thtk_error_t * error = NULL ;
379381 int entry_index ;
380382
@@ -398,8 +400,9 @@ main(
398400 exit (1 );
399401 }
400402
401- #pragma omp parallel for
402- for (ssize_t entry_index = 0 ; entry_index < entry_count ; ++ entry_index ) {
403+ ssize_t entry_index ;
404+ #pragma omp parallel for schedule(dynamic)
405+ for (entry_index = 0 ; entry_index < entry_count ; ++ entry_index ) {
403406 thtk_error_t * error = NULL ;
404407 if (!thdat_extract_file (state , entry_index , & error )) {
405408 print_error (error );
You can’t perform that action at this time.
0 commit comments