Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
cmake_minimum_required(VERSION 3.18)
project(ARC VERSION 0.0.2 LANGUAGES C)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(BUILD_SHARED_LIBS "prefer shared libraries" ON)

#correct was to set a default build type
# https://blog.kitware.com/cmake-and-the-default-build-type/
set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "No build type was set. Setting build type to ${default_build_type}.")
set(CMAKE_BUILD_TYPE ${default_build_type} CACHE
STRING "Choose the type to build" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()


include(GNUInstallDirs)
include(CTest)

find_package(OpenMP REQUIRED)


add_library(arc
src/arc.c
src/galois.c
src/jerasure.c
src/reed_sol.c
)
target_link_libraries(
arc
PUBLIC
OpenMP::OpenMP_C
m
)
target_include_directories(
arc
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/ARC>
)

install(TARGETS arc EXPORT ARCConfig
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(EXPORT ARCConfig NAMESPACE ARC:: DESTINATION ${CMAKE_INSTALL_DATADIR}/ARC/cmake)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ARC)

if(BUILD_TESTING)
add_subdirectory(test)
endif()
option(BUILD_EXAMPLES "build example codes" OFF)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
41 changes: 0 additions & 41 deletions Makefile

This file was deleted.

17 changes: 17 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

find_package(LibPressio REQUIRED)
find_package(std_compat REQUIRED)
find_package(SZ REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(ZLIB REQUIRED)
pkg_search_module(ZSTD IMPORTED_TARGET GLOBAL libzstd)
pkg_search_module(FFTW3 QUIET IMPORTED_TARGET GLOBAL fftw3)

add_executable(arc_pressio_example arc_pressio_example.c)
target_link_libraries(arc_pressio_example PRIVATE arc LibPressio::libpressio SZ)

add_executable(libpressio_example_sz libpressio_example_sz.c)
target_link_libraries(libpressio_example_sz PRIVATE arc LibPressio::libpressio SZ)

add_executable(libpressio_example_zfp libpressio_example_zfp.c)
target_link_libraries(libpressio_example_zfp PRIVATE arc LibPressio::libpressio SZ)
36 changes: 0 additions & 36 deletions examples/Makefile

This file was deleted.

6 changes: 4 additions & 2 deletions examples/arc_pressio_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int main(int argc, char* argv[]) {
}

// Utilize ARC library
arc_init_w_timing(1);
arc_init(1);

// Get a pointer to uint8_t data from libPressio
size_t compressed_size;
Expand All @@ -98,8 +98,10 @@ int main(int argc, char* argv[]) {
double time_constraint = atof(argv[2]);
uint8_t * arc_encoded_data;
uint32_t arc_encoded_data_size;
int num_choices = 1;
int ecc_choices[] = {ARC_ANY_ECC};
gettimeofday(&start, NULL);
ret = arc_encode(data, (uint32_t)compressed_size, memory_constraint, time_constraint, &arc_encoded_data, &arc_encoded_data_size);
ret = arc_encode(data, (uint32_t)compressed_size, memory_constraint, time_constraint, ecc_choices, num_choices, &arc_encoded_data, &arc_encoded_data_size);
gettimeofday(&stop, NULL);
encode_time_taken = (double)(stop.tv_usec - start.tv_usec) / 1000000 + (double)(stop.tv_sec - start.tv_sec);
if (ret == 0){
Expand Down
10 changes: 9 additions & 1 deletion include/arc.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -53,4 +57,8 @@ uint8_t arc_calculate_secded_uint8 (uint8_t byte);
int arc_secded_encode(uint8_t* data, uint32_t data_size, uint32_t block_size, uint32_t threads, uint8_t** encoded_data, uint32_t* encoded_data_size);
int arc_secded_decode(uint8_t* encoded_data, uint32_t encoded_data_size, uint8_t** data, uint32_t* data_size);
int arc_reed_solomon_encode(uint8_t* data, uint32_t data_size, uint32_t data_devices, uint32_t code_devices, uint32_t threads, uint8_t** encoded_data, uint32_t* encoded_data_size);
int arc_reed_solomon_decode(uint8_t* encoded_data, uint32_t encoded_data_size, uint8_t** data, uint32_t *data_size);
int arc_reed_solomon_decode(uint8_t* encoded_data, uint32_t encoded_data_size, uint8_t** data, uint32_t *data_size);

#ifdef __cplusplus
}
#endif
6 changes: 6 additions & 0 deletions include/galois.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifdef __cplusplus
extern "C" {
#endif
/* Galois.h
* James S. Plank

Expand Down Expand Up @@ -109,3 +112,6 @@ void galois_w32_region_multiply(char *region, /* Region to multiply */
int add); /* If (r2 != NULL && add) the produce is XOR'd with r2 */

#endif
#ifdef __cplusplus
}
#endif
6 changes: 6 additions & 0 deletions include/jerasure.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifdef __cplusplus
extern "C" {
#endif
/* jerasure.h - header of kernel procedures
* James S. Plank

Expand Down Expand Up @@ -298,3 +301,6 @@ int *jerasure_matrix_multiply(int *m1, int *m2, int r1, int c1, int r2, int c2,
void jerasure_get_stats(double *fill_in);

#endif
#ifdef __cplusplus
}
#endif
6 changes: 6 additions & 0 deletions include/reed_sol.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifdef __cplusplus
extern "C" {
#endif
/* reed_sol.h
* James S. Plank

Expand Down Expand Up @@ -57,3 +60,6 @@ extern int *reed_sol_r6_coding_matrix(int k, int w);
extern void reed_sol_galois_w08_region_multby_2(char *region, int nbytes);
extern void reed_sol_galois_w16_region_multby_2(char *region, int nbytes);
extern void reed_sol_galois_w32_region_multby_2(char *region, int nbytes);
#ifdef __cplusplus
}
#endif
Binary file removed lib64/libarc.a
Binary file not shown.
Loading