Skip to content

Commit

Permalink
Initial conversion to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew-Whitlock committed Sep 26, 2024
1 parent 5975281 commit 49c3bbb
Show file tree
Hide file tree
Showing 23 changed files with 44 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ test/request_tracking/fenix_request_tracking_test
test/request_tracking/fenix_request_tracking_test_nofenix
build/
install/
spack-*

# Other
*~
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

cmake_minimum_required(VERSION 3.10.2)

project(Fenix C)
project(Fenix C CXX)
# The version number.
set(FENIX_VERSION_MAJOR 1)
set(FENIX_VERSION_MINOR 0)
Expand Down
30 changes: 15 additions & 15 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ configure_file (${CMAKE_SOURCE_DIR}/include/fenix-config.h.in
FILE(GLOB Fenix_HEADERS ${CMAKE_SOURCE_DIR}/include/*.h)

set (Fenix_SOURCES
fenix.c
fenix_mpi_override.c
fenix_opt.c
fenix_process_recovery.c
fenix_util.c
fenix_data_recovery.c
fenix_data_group.c
fenix_data_policy.c
fenix_data_policy_in_memory_raid.c
fenix_data_member.c
fenix_data_subset.c
fenix_comm_list.c
fenix_callbacks.c
globals.c
fenix.cpp
fenix_mpi_override.cpp
fenix_opt.cpp
fenix_process_recovery.cpp
fenix_util.cpp
fenix_data_recovery.cpp
fenix_data_group.cpp
fenix_data_policy.cpp
fenix_data_policy_in_memory_raid.cpp
fenix_data_member.cpp
fenix_data_subset.cpp
fenix_comm_list.cpp
fenix_callbacks.cpp
globals.cpp
)

add_library( fenix STATIC ${Fenix_SOURCES})

target_link_libraries(fenix PUBLIC MPI::MPI_C)
target_link_libraries(fenix PUBLIC MPI::MPI_CXX)

target_include_directories(fenix
PUBLIC
Expand Down
2 changes: 1 addition & 1 deletion src/fenix.c → src/fenix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int Fenix_Data_member_create( int group_id, int member_id, void *buffer, int cou
}

int Fenix_Data_group_get_redundancy_policy( int group_id, int* policy_name, void *policy_value, int *flag ) {
return __fenix_group_get_redundancy_policy( group_id, policy_name, policy_value, flag );
return __fenix_group_get_redundancy_policy( group_id, policy_name, (int*)policy_value, flag );
}

int Fenix_Data_wait(Fenix_Request request) {
Expand Down
4 changes: 2 additions & 2 deletions src/fenix_callbacks.c → src/fenix_callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int __fenix_callback_register(void (*recover)(MPI_Comm, int, void *), void *call
{
int error_code = FENIX_SUCCESS;
if (fenix.fenix_init_flag) {
fenix_callback_func *fp = s_malloc(sizeof(fenix_callback_func));
fenix_callback_func *fp = (fenix_callback_func *) s_malloc(sizeof(fenix_callback_func));
fp->x = recover;
fp->y = callback_data;
__fenix_callback_push( &fenix.callback_list, fp);
Expand Down Expand Up @@ -105,7 +105,7 @@ void __fenix_callback_invoke_all(int error)

void __fenix_callback_push(fenix_callback_list_t **head, fenix_callback_func *fp)
{
fenix_callback_list_t *callback = malloc(sizeof(fenix_callback_list_t));
fenix_callback_list_t *callback = (fenix_callback_list_t *) malloc(sizeof(fenix_callback_list_t));
callback->callback = fp;
callback->next = *head;
*head = callback;
Expand Down
4 changes: 2 additions & 2 deletions src/fenix_comm_list.c → src/fenix_comm_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ void __fenix_comm_list_destroy(void) {
else {
fenix_comm_list_elm_t *current = my_list.tail;
while (current->next) {
fenix_comm_list_elm_t *new = current->next;
fenix_comm_list_elm_t *next = current->next;
MPIX_Comm_revoke(*current->comm);
PMPI_Comm_free(current->comm);
free(current);
current = new;
current = next;
}
MPIX_Comm_revoke(*current->comm);
PMPI_Comm_free(current->comm);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ int __imr_member_restore(fenix_group_t* g, int member_id,
if(recovery_locally_possible) retval = FENIX_SUCCESS;

} else if (group->raid_mode == 5){
int* set_results = malloc(sizeof(int) * group->set_size);
int* set_results = (int *) malloc(sizeof(int) * group->set_size);
MPI_Allgather((void*)&found_member, 1, MPI_INT, (void*)set_results, 1, MPI_INT,
group->set_comm);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int __fenix_preinit(int *role, MPI_Comm comm, MPI_Comm *new_comm, int *argc, cha

MPI_Comm_create_errhandler(__fenix_test_MPI, &fenix.mpi_errhandler);

fenix.world = malloc(sizeof(MPI_Comm));
fenix.world = (MPI_Comm *)malloc(sizeof(MPI_Comm));
MPI_Comm_dup(comm, fenix.world);
PMPI_Comm_set_errhandler(*fenix.world, fenix.mpi_errhandler);

Expand Down Expand Up @@ -659,7 +659,7 @@ int* __fenix_get_fail_ranks(int *survivor_world, int survivor_world_size, int fa
qsort(survivor_world, survivor_world_size, sizeof(int), __fenix_comparator);
int failed_pos = 0;

int *fail_ranks = calloc(fail_world_size, sizeof(int));
int *fail_ranks = (int *)calloc(fail_world_size, sizeof(int));

int i;
for (i = 0; i < survivor_world_size + fail_world_size; i++) {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/failed_spares/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#

add_executable(fenix_failed_spares fenix_failed_spares.c)
target_link_libraries(fenix_failed_spares fenix MPI::MPI_C)
target_link_libraries(fenix_failed_spares fenix MPI::MPI_CXX)

add_test(NAME failed_spares
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 6 ${MPIEXEC_PREFLAGS} fenix_failed_spares ${MPIEXEC_POSTFLAGS} 3 1 3 4 )
2 changes: 1 addition & 1 deletion test/issend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
#

add_executable(fenix_issend_test fenix_issend_test.c)
target_link_libraries(fenix_issend_test fenix MPI::MPI_C)
target_link_libraries(fenix_issend_test fenix MPI::MPI_CXX)

add_test(NAME issend COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 5 ${MPIEXEC_PREFLAGS} fenix_issend_test ${MPIEXEC_POSTFLAGS} "1")
14 changes: 14 additions & 0 deletions test/message_replay/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# This file is part of Fenix
# Copyright (c) 2016 Rutgers University and Sandia Corporation.
# This software is distributed under the BSD License.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
# For more information, see the LICENSE file in the top Fenix
# directory.
#

add_executable(fenix_message_logging_test fenix_message_logging_test.cxx)
target_link_libraries(fenix_message_logging_test fenix MPI::MPI_CXX)

add_test(NAME request_cancelled COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 5 ${MPIEXEC_PREFLAGS} fenix_message_logging_test ${MPIEXEC_POSTFLAGS} "1")
2 changes: 1 addition & 1 deletion test/no_jump/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
#

add_executable(fenix_no_jump_test fenix_no_jump_test.c)
target_link_libraries(fenix_no_jump_test fenix MPI::MPI_C)
target_link_libraries(fenix_no_jump_test fenix MPI::MPI_CXX)

add_test(NAME no_jump COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 5 ${MPIEXEC_PREFLAGS} fenix_no_jump_test ${MPIEXEC_POSTFLAGS} "1")
2 changes: 1 addition & 1 deletion test/request_cancelled/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
#

add_executable(fenix_request_cancelled_test fenix_req_cancelled_test.c)
target_link_libraries(fenix_request_cancelled_test fenix MPI::MPI_C)
target_link_libraries(fenix_request_cancelled_test fenix MPI::MPI_CXX)

add_test(NAME request_cancelled COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 5 ${MPIEXEC_PREFLAGS} fenix_request_cancelled_test ${MPIEXEC_POSTFLAGS} "1")
2 changes: 1 addition & 1 deletion test/request_tracking/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#

add_executable(fenix_request_tracking_test fenix_request_tracking_test.c)
target_link_libraries(fenix_request_tracking_test fenix MPI::MPI_C)
target_link_libraries(fenix_request_tracking_test fenix MPI::MPI_CXX)

add_test(NAME request_tracking
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 3 ${MPIEXEC_PREFLAGS} fenix_request_tracking_test ${MPIEXEC_POSTFLAGS})

0 comments on commit 49c3bbb

Please sign in to comment.