Skip to content

Commit ef3efe6

Browse files
Feature/dart (#12)
1 parent 67791ef commit ef3efe6

File tree

14 files changed

+185
-167
lines changed

14 files changed

+185
-167
lines changed

.docker/dev_base.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ RUN apt-get update && apt-get install -y \
1717
libmpich-dev \
1818
libhdf5-dev \
1919
libhdf5-mpich-dev \
20+
libtiff5 \
21+
libtiff5-dev \
2022
uuid \
2123
uuid-dev \
2224
autoconf \

examples/llsm/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

examples/llsm/CMakeLists.txt

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
cmake_minimum_required (VERSION 2.8.12)
2+
3+
# Setup cmake policies.
4+
foreach(p
5+
CMP0012
6+
CMP0013
7+
CMP0014
8+
CMP0022 # CMake 2.8.12
9+
CMP0025 # CMake 3.0
10+
CMP0053 # CMake 3.1
11+
CMP0054 # CMake 3.1
12+
CMP0074 # CMake 3.12
13+
CMP0075 # CMake 3.12
14+
CMP0083 # CMake 3.14
15+
CMP0093 # CMake 3.15
16+
)
17+
if(POLICY ${p})
18+
cmake_policy(SET ${p} NEW)
19+
endif()
20+
endforeach()
21+
22+
project(PDC_LLSM_EXAM C)
23+
24+
set(LLSM_EXT_INCLUDE_DIRS "")
25+
set(LLSM_EXT_LIBRARIES "")
26+
27+
28+
29+
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
30+
31+
find_package(PDC REQUIRED)
32+
if(PDC_FOUND)
33+
#message(STATUS "PDC include directory: ${PDC_INCLUDE_DIR}")
34+
set(LLSM_EXT_INCLUDE_DIRS ${PDC_INCLUDE_DIR}
35+
${LLSM_EXT_INCLUDE_DIRS}
36+
)
37+
set(LLSM_EXT_LIBRARIES pdc ${LLSM_EXT_LIBRARIES})
38+
endif()
39+
40+
option(USE_SYSTEM_MPI "Use system-installed OpenMP." ON)
41+
if(USE_SYSTEM_MPI)
42+
find_package(MPI)
43+
if(MPI_FOUND)
44+
add_definitions(-DLLSM_ENABLE_MPI=1)
45+
SET(CMAKE_C_COMPILER ${MPI_C_COMPILER})
46+
SET(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER})
47+
set(LLSM_EXT_INCLUDE_DIRS ${MPI_C_INCLUDE_PATH}
48+
${LLSM_EXT_INCLUDE_DIRS}
49+
)
50+
set(LLSM_EXT_LIBRARIES ${MPI_C_LIBRARIES} ${LLSM_EXT_LIBRARIES})
51+
endif()
52+
endif()
53+
54+
option(USE_SYSTEM_OPENMP "Use system-installed OpenMP." ON)
55+
if(USE_SYSTEM_OPENMP)
56+
find_package(OpenMP REQUIRED)
57+
if(OPENMP_FOUND)
58+
add_definitions(-DENABLE_OPENMP=1)
59+
set(ENABLE_OPENMP 1)
60+
set(OPENMP_LIBRARIES "${OpenMP_C_LIBRARIES}")
61+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
62+
else()
63+
message(FATAL_ERROR "OpenMP not found")
64+
endif()
65+
endif()
66+
67+
include_directories(
68+
${LLSM_EXT_INCLUDE_DIRS}
69+
)
70+
71+
72+
# Find LibTIFF
73+
option(USE_LIB_TIFF "Enable LibTiff." ON)
74+
if(USE_LIB_TIFF)
75+
find_package(TIFF REQUIRED)
76+
if(TIFF_FOUND)
77+
set(LLSM_LIB_SOURCE
78+
llsm_aux/parallelReadTiff.c
79+
llsm_aux/csvReader.c
80+
llsm_aux/pdc_list.c
81+
)
82+
# Add the LibTIFF include directory to the include path
83+
include_directories(${TIFF_INCLUDE_DIRS})
84+
add_library(llsm_tiff ${LLSM_LIB_SOURCE})
85+
target_compile_options(llsm_tiff PRIVATE ${OpenMP_C_FLAGS})
86+
target_link_libraries(llsm_tiff PUBLIC ${OpenMP_C_LIBRARIES})
87+
target_link_libraries(llsm_tiff PUBLIC ${TIFF_LIBRARIES})
88+
target_include_directories(llsm_tiff PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/llsm)
89+
90+
add_executable(llsm_importer llsm_importer.c)
91+
target_link_libraries(llsm_importer ${PDC_EXT_LIB_DEPENDENCIES} pdc ${TIFF_LIBRARIES} llsm_tiff ${LLSM_EXT_LIBRARIES})
92+
target_include_directories(llsm_importer PUBLIC ${LLSM_EXT_INCLUDE_DIRS})
93+
else()
94+
message(WARNING "LibTiff not found, ignore building the executables which requires LibTiff support.")
95+
endif()
96+
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.

tools/llsm/parallelReadTiff.c renamed to examples/llsm/llsm_aux/parallelReadTiff.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#include "parallelReadTiff.h"
22
#include "tiffio.h"
3+
#include "inttypes.h"
34

4-
#define ENABLE_OPENMP
5+
// #define ENABLE_OPENMP
56

67
#ifdef ENABLE_OPENMP
78
#include "omp.h"
@@ -50,7 +51,7 @@ readTiffParallelBak(uint64_t x, uint64_t y, uint64_t z, const char *fileName, vo
5051

5152
int counter = 0;
5253
while (!TIFFSetDirectory(tif, (uint64_t)dir) && counter < 3) {
53-
printf("Thread %d: File \"%s\" Directory \"%d\" failed to open. Try %d\n", w, fileName, dir,
54+
printf("Thread %d: File \"%s\" Directory \"%"PRId64"\" failed to open. Try %d\n", w, fileName, dir,
5455
counter + 1);
5556
counter++;
5657
}
@@ -344,7 +345,7 @@ readTiffParallel2DBak(uint64_t x, uint64_t y, uint64_t z, const char *fileName,
344345

345346
int counter = 0;
346347
while (!TIFFSetDirectory(tif, (uint64_t)0) && counter < 3) {
347-
printf("Thread %d: File \"%s\" Directory \"%d\" failed to open. Try %d\n", w, fileName, dir,
348+
printf("Thread %d: File \"%s\" Directory \"%"PRId64"\" failed to open. Try %d\n", w, fileName, dir,
348349
counter + 1);
349350
counter++;
350351
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)