Skip to content

Commit

Permalink
Merge pull request #46 from leobago/devel
Browse files Browse the repository at this point in the history
Release candidate for version 0.9.6
  • Loading branch information
leobago authored Jun 13, 2016
2 parents b509cd5 + 3dbc3d5 commit ea6c5ca
Show file tree
Hide file tree
Showing 33 changed files with 2,487 additions and 1,498 deletions.
39 changes: 39 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
sudo: required
dist: trusty

language: c

env:
global:
- BUILD_DIR="$TRAVIS_BUILD_DIR/build"
- secure: "Dw0r4cbZoT0QoIlI7XWLdhPQxL62CQzskdw3tUth4eSWJd/0IIvLq/ogaZZbYWGH4lifI4p5NMzEpHJ5yFjWnO/ZcpVTZ26SJEFwfBrPUzeu3MV30poX89EYxWz+dE4xPFKzAAKnemlcVxfTHE+z3vW5klnjg5bRH3+pFKoFVBX6M2ABPXcigkpbd1dnXqQK+36v0yx/SF4Yg607vLLPVfcmcU+ohT52OENVkoeEllOxmGxdVfdskEVQ9O16BbtxNSthYQFplvFn5RrpvknRarby51E+7eMf9sOey2H6MWtZYFKXKiascUz5ZLPIt0mFCW1x2wFC39cxMZNFURg+hHlGKUGV9Bt7B7K/XAwvPhY6X+td4OYPR2B68vywxpPlShiTg8iduYg1H4bdVzt+1qdRHsg2qmyJe5eQBMwW5fEVOffJhfVAiG5ceDWzQJQt5cEKn/2yxt1bX3sC7Hl6lzTQ1X6DuLWi9cCsKqsAB7ht/ZC1m13YGRyjghG9RDsRfM2FPy0w0iOHDAGrNzQVPPDDxxgNi/xpmqPlkvjRSz3Pmj6VeAZ2cG68pls+oKyzcWEhCeSL3uT3ShKBfrpQcFxVFzsdTWzH6XYul/HHrUnYKGtd3K1MW59Dng5WcD5xi8n76/wmlkXUoWmYNjfGsP5wwcz/yLfc/CRDRB3P4jo="

addons:
coverity_scan:
project:
name: sclaomir/fti
description: Fault Tolerance Interface
notification_email: [email protected]
build_command_prepend: cmake ..
build_command: make
branch_pattern: devel

os:
- linux

compiler:
- gcc

cache:
apt: true

before_install:
- sudo apt-get update -qq
- sudo apt-get install -y cmake gcc gfortran openmpi-bin libopenmpi-dev

before_script:
- mkdir $BUILD_DIR
- cd $BUILD_DIR
- cmake ..

script: make
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Author:
Collaborators:

Julien BIGOT
Slawomir Zdanowski
Adele VILLIERMET
Sheng DI
Faysal BOUI
Expand Down
103 changes: 59 additions & 44 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,70 +1,85 @@
cmake_minimum_required(VERSION 2.8)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeScripts")
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)

if ( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}" )
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
project(FTI C Fortran)
endif()

option(ENABLE_FORTRAN "Enables the generation of the Fortran wrapper for FTI" ON)
option(ENABLE_EXAMPLES "Enables the generation of examples" ON)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeScripts")
include(AppendProperty)
include(BPP)
include(FortranCInterface)

find_package(MPI REQUIRED)

option(ENABLE_FORTRAN "Enables the generation of the Fortran wrapper for FTI" ON)
add_subdirectory(deps)

include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_SOURCE_DIR}/include" ${MPI_Fortran_INCLUDE_PATH} ${MPI_C_INCLUDE_PATH})
include_directories("${CMAKE_CURRENT_BINARY_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_SOURCE_DIR}/include"
${MPI_Fortran_INCLUDE_PATH} ${MPI_C_INCLUDE_PATH})

set (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
set (CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include)

set(SRC_FTI
src/galois.c
src/jerasure.c
src/dictionary.c
src/iniparser.c
src/checkpoint.c
src/postckpt.c
src/recover.c
src/postreco.c
src/topo.c
src/conf.c
src/meta.c
src/tools.c
src/api.c
)
append_property(SOURCE ${SRC_FTI} PROPERTY COMPILE_FLAGS " ${MPI_C_COMPILE_FLAGS} ")

add_library(fti.static STATIC ${SRC_FTI})
src/api.c src/checkpoint.c src/conf.c src/meta.c
src/postckpt.c src/postreco.c src/recover.c
src/tools.c src/topo.c)

append_property(SOURCE ${SRC_FTI}
PROPERTY COMPILE_FLAGS "${MPI_C_COMPILE_FLAGS}")

add_library(fti.static STATIC ${SRC_FTI}
$<TARGET_OBJECTS:iniparser> $<TARGET_OBJECTS:jerasure>)
add_library(fti.shared SHARED ${SRC_FTI}
$<TARGET_OBJECTS:iniparser> $<TARGET_OBJECTS:jerasure>)

append_property(TARGET fti.static fti.shared
PROPERTY LINK_FLAGS "${MPI_C_LINK_FLAGS}")
set_property(TARGET fti.static fti.shared
PROPERTY OUTPUT_NAME fti)

target_link_libraries(fti.static ${MPI_C_LIBRARIES})
add_library(fti.shared SHARED ${SRC_FTI})
target_link_libraries(fti.shared ${MPI_C_LIBRARIES})
append_property(TARGET fti.static fti.shared PROPERTY LINK_FLAGS " ${MPI_C_LINK_FLAGS} ")
set_property(TARGET fti.static fti.shared PROPERTY OUTPUT_NAME fti)

install(TARGETS fti.static fti.shared DESTINATION lib)
install(FILES "include/fti.h" "include/dictionary.h" "include/galois.h" "include/iniparser.h" "include/jerasure.h" DESTINATION include)
install(TARGETS fti.static fti.shared
DESTINATION lib)
install(FILES "include/fti.h"
DESTINATION include)

if ( ENABLE_FORTRAN )
if(ENABLE_FORTRAN)
bpp_preprocess(BPP_FTI_F90
src/interface.F90.bpp
)
set(SRC_FTI_F90
${BPP_FTI_F90}
src/ftif.c
)
append_property(SOURCE ${SRC_FTI_F90} PROPERTY COMPILE_FLAGS " ${MPI_Fortran_COMPILE_FLAGS} ")
src/fortran/interface.F90.bpp)
set(SRC_FTI_F90 ${BPP_FTI_F90}
src/fortran/ftif.c)
append_property(SOURCE ${SRC_FTI_F90}
PROPERTY COMPILE_FLAGS "${MPI_Fortran_COMPILE_FLAGS}")

add_library(fti_f90.static STATIC ${SRC_FTI_F90})
target_link_libraries(fti_f90.static fti.static ${MPI_Fortran_LIBRARIES} ${MPI_C_LIBRARIES})
target_link_libraries(fti_f90.static
fti.static ${MPI_Fortran_LIBRARIES} ${MPI_C_LIBRARIES})

add_library(fti_f90.shared SHARED ${SRC_FTI_F90})
target_link_libraries(fti_f90.shared fti.shared ${MPI_Fortran_LIBRARIES} ${MPI_C_LIBRARIES})
append_property(TARGET fti_f90.static fti_f90.shared PROPERTY LINK_FLAGS " ${MPI_Fortran_LINK_FLAGS} ${MPI_C_LINK_FLAGS} ")
set_property(TARGET fti_f90.static fti_f90.shared PROPERTY OUTPUT_NAME fti_f90)
target_link_libraries(fti_f90.shared
fti.shared ${MPI_Fortran_LIBRARIES} ${MPI_C_LIBRARIES})

install(TARGETS fti_f90.static fti_f90.shared DESTINATION lib)
install(FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/fti.mod DESTINATION include)
append_property(TARGET fti_f90.static fti_f90.shared
PROPERTY LINK_FLAGS "${MPI_Fortran_LINK_FLAGS} ${MPI_C_LINK_FLAGS}")
set_property(TARGET fti_f90.static fti_f90.shared
PROPERTY OUTPUT_NAME fti_f90)

install(TARGETS fti_f90.static fti_f90.shared
DESTINATION lib)
install(FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/fti.mod
DESTINATION include)
endif()

if ( NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}" )
if(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(FTI_INCLUDE_PATH "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE)
endif()

if(ENABLE_EXAMPLES)
add_subdirectory(examples)
endif()
2 changes: 2 additions & 0 deletions deps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_subdirectory(iniparser)
add_subdirectory(jerasure)
8 changes: 8 additions & 0 deletions deps/iniparser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set(SRC_iniparser
dictionary.h dictionary.c
iniparser.h iniparser.c)

append_property(SOURCE ${SRC_iniparser}
PROPERTY COMPILE_FLAGS "-fPIC")

add_library(iniparser OBJECT ${SRC_iniparser})
File renamed without changes.
File renamed without changes.
11 changes: 8 additions & 3 deletions src/iniparser.c → deps/iniparser/iniparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ static char * strlwc(const char * s)
static char * strstrip(const char * s)
{
static char l[ASCIILINESZ+1];
char * last ;
char * last;

if (s==NULL) return NULL ;

while (isspace((int)*s) && *s) s++;
memset(l, 0, ASCIILINESZ+1);
strcpy(l, s);
strncpy(l, s, ASCIILINESZ);
last = l + strlen(l);
while (last > l) {
if (!isspace((int)*(last-1)))
Expand Down Expand Up @@ -562,7 +562,11 @@ static line_status iniparser_line(
char line[ASCIILINESZ+1];
int len ;

strcpy(line, strstrip(input_line));
memset(line, 0, ASCIILINESZ + 1);
len = (int)strlen(strstrip(input_line));
if (len > ASCIILINESZ)
len = ASCIILINESZ;
strncpy(line, strstrip(input_line), len);
len = (int)strlen(line);

sta = LINE_UNPROCESSED ;
Expand Down Expand Up @@ -608,6 +612,7 @@ static line_status iniparser_line(
} else {
/* Generate syntax error */
sta = LINE_ERROR ;
printf("===== > %s ===> %s\n", input_line, line);
}
return sta ;
}
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions deps/jerasure/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set(SRC_jerasure
galois.h galois.c
jerasure.h jerasure.c)

append_property(SOURCE ${SRC_jerasure}
PROPERTY COMPILE_FLAGS "-fPIC")

add_library(jerasure OBJECT ${SRC_jerasure})
5 changes: 3 additions & 2 deletions src/galois.c → deps/jerasure/galois.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,9 @@ int galois_single_divide(int a, int b, int w)
sum_j = galois_inverse(b, w);
return galois_single_multiply(a, sum_j, w);
}
fprintf(stderr, "Galois_single_divide - no implementation for w=%d\n", w);
exit(1);
// unreachable code
//fprintf(stderr, "Galois_single_divide - no implementation for w=%d\n", w);
//exit(1);
}

int galois_shift_divide(int a, int b, int w)
Expand Down
File renamed without changes.
17 changes: 14 additions & 3 deletions src/jerasure.c → deps/jerasure/jerasure.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ int *jerasure_matrix_to_bitmatrix(int k, int m, int w, int *matrix)
int rowelts, rowindex, colindex, elt, i, j, l, x;

bitmatrix = talloc(int, k*m*w*w);
if (matrix == NULL) { return NULL; }
if (matrix == NULL) {
free(bitmatrix);
return NULL;
}

rowelts = k * w;
rowindex = 0;
Expand Down Expand Up @@ -397,6 +400,8 @@ int jerasure_invert_matrix(int *mat, int *inv, int rows, int w)
tmp = mat[row_start+i];
if (tmp != 1) {
inverse = galois_single_divide(1, tmp, w);
if (inverse < 0)
return -1;
for (j = 0; j < cols; j++) {
mat[row_start+j] = galois_single_multiply(mat[row_start+j], inverse, w);
inv[row_start+j] = galois_single_multiply(inv[row_start+j], inverse, w);
Expand Down Expand Up @@ -825,7 +830,11 @@ static int **jerasure_generate_decoding_schedule(int k, int m, int w, int *bitma
row_ids = talloc(int, k+m);
ind_to_row = talloc(int, k+m);

if (set_up_ids_for_scheduled_decoding(k, m, erasures, row_ids, ind_to_row) < 0) return NULL;
if (set_up_ids_for_scheduled_decoding(k, m, erasures, row_ids, ind_to_row) < 0) {
free(row_ids);
free(ind_to_row);
return NULL;
}

/* Now, we're going to create one decoding matrix which is going to
decode everything with one call. The hope is that the scheduler
Expand Down Expand Up @@ -1247,6 +1256,7 @@ int **jerasure_smart_bitmatrix_to_schedule(int k, int m, int w, int *bitmatrix)
ptr = bitmatrix;

bestdiff = k*w+1;
bestrow = -1;
top = 0;
for (i = 0; i < m*w; i++) {
no = 0;
Expand Down Expand Up @@ -1312,7 +1322,8 @@ int **jerasure_smart_bitmatrix_to_schedule(int k, int m, int w, int *bitmatrix)
operations[op][1] = j%w;
operations[op][2] = k+row/w;
operations[op][3] = row%w;
optodo = 1;
// unused value
//optodo = 1;
op++;
}
}
Expand Down
File renamed without changes.
42 changes: 42 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
link_directories(${CMAKE_BINARY_DIR}/lib)

add_executable(hd.exe heatdis.c)
target_link_libraries(hd.exe ${CMAKE_BINARY_DIR}/lib/libfti.a ${MPI_C_LIBRARIES} m)

if(MPI_C_COMPILE_FLAGS)
set_target_properties(hd.exe PROPERTIES
COMPILE_FLAGS "${MPI_C_COMPILE_FLAGS}")
endif()

if(MPI_C_LINK_FLAGS)
set_target_properties(hd.exe PROPERTIES
LINK_FLAGS "${MPI_C_LINK_FLAGS}")
endif()

add_executable(hd2.exe heatd2.c)
target_link_libraries(hd2.exe ${CMAKE_BINARY_DIR}/lib/libfti.a ${MPI_C_LIBRARIES} m)

if(MPI_C_COMPILE_FLAGS)
set_target_properties(hd2.exe PROPERTIES
COMPILE_FLAGS "${MPI_C_COMPILE_FLAGS}")
endif()

if(MPI_C_LINK_FLAGS)
set_target_properties(hd2.exe PROPERTIES
LINK_FLAGS "${MPI_C_LINK_FLAGS}")
endif()

if(ENABLE_FORTRAN)
add_executable(hdf.exe fheatdis.f90)
target_link_libraries(hdf.exe fti_f90 ${CMAKE_BINARY_DIR}/lib/libfti.a ${MPI_Fortran_LIBRARIES} m)

if(MPI_Fortran_COMPILE_FLAGS)
set_target_properties(hdf.exe PROPERTIES
COMPILE_FLAGS "${MPI_Fortran_COMPILE_FLAGS}")
endif()

if(MPI_Fortran_LINK_FLAGS)
set_target_properties(hdf.exe PROPERTIES
LINK_FLAGS "${MPI_Fortran_LINK_FLAGS}")
endif()
endif()
12 changes: 6 additions & 6 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Makefile to test FTI library with the heat distribution program.

## PLEASE SET THIS VARIABLE BEFORE COMPILING
FTIPATH = /path/to/fti/install/directory
FTIPATH = /path/to/fti/

## COMPILERS
MPICC ?= mpicc
Expand All @@ -11,11 +11,11 @@ MPIRUN ?= mpirun

## FLAGS
# Compiling using shared library
FTIFLAG = -I$(FTIPATH)/include -L$(FTIPATH)/lib -lfti -lm
FFTIFLAG = -I$(FTIPATH)/include -L$(FTIPATH)/lib -lfti_f90 -lfti -lm
#FTIFLAG = -I$(FTIPATH)/include -L$(FTIPATH)/lib -lfti -lm
#FFTIFLAG = -I$(FTIPATH)/include -L$(FTIPATH)/lib -lfti_f90 -lfti -lm
# Compiling using static library
#FTIFLAG = -I$(FTIPATH)/include $(FTIPATH)/lib/libfti.a
#FFTIFLAG = -I$(FTIPATH)/include $(FTIPATH)/lib/libfti_f90.a $(FTIPATH)/lib/libfti.a
FTIFLAG = -I$(FTIPATH)/include $(FTIPATH)/lib/libfti.a -lm
FFTIFLAG = -I$(FTIPATH)/include $(FTIPATH)/lib/libfti_f90.a $(FTIPATH)/lib/libfti.a -lm

## TARGETS
all: hd hd2 hdf
Expand All @@ -30,7 +30,7 @@ hdf: fheatdis.f90
$(MPIFC) -o hdf.exe fheatdis.f90 $(FFTIFLAG)

hdt:
$(MPIRUN) -np 8 ./hd.exe 32 config.fti
$(MPIRUN) -np 8 ./hd.exe 4 config.fti

hdv:
./plot.sh
Expand Down
Loading

0 comments on commit ea6c5ca

Please sign in to comment.