Skip to content

Commit ef3efe6

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

14 files changed

+185
-167
lines changed

.docker/dev_base.Dockerfile

+2
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

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

examples/llsm/CMakeLists.txt

+96
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 examples/llsm/llsm_aux/parallelReadTiff.c

+4-3
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.

tools/llsm_importer.c examples/llsm/llsm_importer.c

+6-11
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,17 @@
44
#include <getopt.h>
55
#include <time.h>
66

7-
#ifndef ENABLE_MPI
8-
#define ENABLE_MPI
9-
#endif
10-
11-
#ifdef ENABLE_MPI
7+
#ifdef LLSM_ENABLE_MPI
128
#include "mpi.h"
13-
// #undef ENABLE_MPI
149
#endif
1510

1611
#include "pdc.h"
1712
// #include "pdc_client_server_common.h"
1813
// #include "pdc_client_connect.h"
1914

20-
#include "llsm/parallelReadTiff.h"
21-
#include "llsm/pdc_list.h"
22-
#include "llsm/csvReader.h"
15+
#include "llsm_aux/parallelReadTiff.h"
16+
#include "llsm_aux/pdc_list.h"
17+
#include "llsm_aux/csvReader.h"
2318
#include <libgen.h>
2419

2520
typedef struct llsm_importer_args_t {
@@ -126,7 +121,7 @@ import_to_pdc(image_info_t *image_info, csv_cell_t *fileName_cell)
126121

127122
duration = getDoubleTimestamp() - start; // end timing the operation and calculate duration in nanoseconds
128123

129-
printf("[Rank %4d] Region_Transfer %s_[%d_Bytes] Done! Time taken: %.4f seconds\n", rank,
124+
printf("[Rank %4d] Region_Transfer %s_[%ld_Bytes] Done! Time taken: %.4f seconds\n", rank,
130125
fileName_cell->field_value, image_info->tiff_size, duration);
131126

132127
// add metadata tags based on the csv row
@@ -372,7 +367,7 @@ main(int argc, char *argv[])
372367
#endif
373368

374369
if (rank == 0) {
375-
printf("[Completion Time] LLSM IMPORTER FINISHES! Time taken: %.4f seconds\n", rank, duration);
370+
printf("[Completion Time] LLSM IMPORTER FINISHES! Time taken: %.4f seconds\n", duration);
376371
}
377372
// free memory for csv table
378373
csv_free_table(csv_table);

src/tools/CMakeLists.txt

+76-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,75 @@
1-
project(${PDC_SOURCE_DIR})
2-
cmake_minimum_required (VERSION 3.0)
1+
set(TOOLS_EXT_INCLUDE "")
2+
set(TOOLS_EXT_LIB "")
3+
4+
# *************************************************
5+
# * MERCURY
6+
# *************************************************
7+
find_package(MERCURY REQUIRED)
8+
if(MERCURY_FOUND)
9+
set(TOOLS_EXT_INCLUDE ${MERCURY_INCLUDE_DIRS}
10+
${TOOLS_EXT_INCLUDE}
11+
)
12+
set(TOOLS_EXT_LIB ${MERCURY_LIBRARIES} ${TOOLS_EXT_LIB})
13+
endif()
14+
15+
#HDF5
16+
find_package(HDF5 MODULE)
17+
if(NOT HDF5_FOUND)
18+
message(STATUS "Could not find HDF5, fallback to NO_MODULE mode.")
19+
find_package(HDF5 NO_MODULE NAMES hdf5 COMPONENTS C shared)
20+
if(NOT HDF5_FOUND)
21+
message(FATAL_ERROR "Could not find HDF5, please check HDF5_DIR or make sure that HDF5 has ben compiled with shared libraries enabled.")
22+
else()
23+
set(HDF5_LIBRARIES ${HDF5_LIBRARIES} hdf5-shared)
24+
set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS} ${HDF5_INCLUDE_DIR})
25+
endif()
26+
endif()
27+
28+
if (HDF5_FOUND)
29+
set(TOOLS_EXT_INCLUDE
30+
${TOOLS_EXT_INCLUDE}
31+
${HDF5_INCLUDE_DIRS}
32+
)
33+
set(TOOLS_EXT_LIB
34+
${TOOLS_EXT_LIB}
35+
${HDF5_LIBRARIES}
36+
)
37+
endif()
38+
39+
# option(USE_SYSTEM_HDF5 "Use system-installed HDF5." ON)
40+
# if(USE_SYSTEM_HDF5)
41+
# find_package(HDF5 NO_MODULE NAMES hdf5 COMPONENTS C shared)
42+
# if(HDF5_FOUND)
43+
# set(HDF5_C_SHARED_LIBRARY hdf5-shared)
44+
# # if(NOT TARGET ${HDF5_C_SHARED_LIBRARY})
45+
# # message(FATAL_ERROR "Could not find hdf5 shared target, please make "
46+
# #"sure that HDF5 has ben compiled with shared libraries enabled.")
47+
# # endif()
48+
# set(TOOLS_EXT_INCLUDE
49+
# ${TOOLS_EXT_INCLUDE}
50+
# ${HDF5_INCLUDE_DIR}
51+
# )
52+
# set(TOOLS_EXT_LIB
53+
# ${TOOLS_EXT_LIB}
54+
# ${HDF5_C_SHARED_LIBRARY}
55+
# )
56+
# endif()
57+
# else()
58+
# # Allow for HDF5 autotools builds
59+
# find_package(HDF5 MODULE REQUIRED)
60+
# if(HDF5_FOUND)
61+
# set(TOOLS_EXT_INCLUDE
62+
# ${TOOLS_EXT_INCLUDE}
63+
# ${HDF5_INCLUDE_DIRS}
64+
# )
65+
# set(TOOLS_EXT_LIB
66+
# ${TOOLS_EXT_LIB}
67+
# ${HDF5_LIBRARIES}
68+
# )
69+
# else()
70+
# message(FATAL_ERROR "Could not find HDF5, please check HDF5_DIR.")
71+
# endif()
72+
# endif()
373

474
include_directories(
575
${CMAKE_CURRENT_SOURCE_DIR}
@@ -10,8 +80,10 @@ include_directories(
1080
${PDC_SOURCE_DIR}/src/client_api/include
1181
$ENV{HOME}/Sandbox/c-blosc/blosc
1282
$ENV{HOME}/include
83+
${TOOLS_EXT_INCLUDE}
1384
)
1485

86+
1587
set(PROGRAMS
1688
pdc_import
1789
pdc_export
@@ -22,12 +94,5 @@ add_library(cjson cjson/cJSON.c)
2294

2395
foreach(program ${PROGRAMS})
2496
add_executable(${program} ${program}.c)
25-
target_link_libraries(${program} pdc)
26-
target_link_libraries(${program} cjson)
27-
endforeach(program)
28-
29-
30-
# *******************************************
31-
# Add the HDF5 library for pdc-neon
32-
# *******************************************
33-
FIND_LIBRARY(HDF5_LIBRARY NAMES hdf5_debug PATHS $ENV{HOME}/lib)
97+
target_link_libraries(${program} pdc cjson ${TOOLS_EXT_LIB})
98+
endforeach(program)

tools/.gitignore

-6
This file was deleted.

0 commit comments

Comments
 (0)