mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-04 14:24:12 +02:00
Add stub for MPI daq POC
This commit is contained in:
+2
-1
@@ -32,4 +32,5 @@ add_subdirectory("core-buffer")
|
||||
add_subdirectory("sf-buffer")
|
||||
add_subdirectory("sf-stream")
|
||||
add_subdirectory("sf-writer")
|
||||
add_subdirectory("jf-live-writer")
|
||||
add_subdirectory("jf-live-writer")
|
||||
add_subdirectory("jf-live-daq")
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
find_package(MPI REQUIRED)
|
||||
# Because of openmpi.
|
||||
add_definitions(-DOMPI_SKIP_MPICXX)
|
||||
|
||||
file(GLOB SOURCES
|
||||
src/*.cpp)
|
||||
|
||||
add_library(jf-live-daq-lib STATIC ${SOURCES})
|
||||
target_include_directories(jf-live-daq-lib
|
||||
PUBLIC include/
|
||||
SYSTEM ${MPI_INCLUDE_PATH})
|
||||
|
||||
target_link_libraries(jf-live-daq-lib
|
||||
external
|
||||
core-buffer-lib
|
||||
${MPI_LIBRARIES})
|
||||
|
||||
add_executable(jf-live-daq src/main.cpp)
|
||||
set_target_properties(jf-live-daq PROPERTIES OUTPUT_NAME jf_live_daq)
|
||||
target_link_libraries(jf-live-daq
|
||||
jf-live-daq-lib
|
||||
)
|
||||
|
||||
enable_testing()
|
||||
add_subdirectory(test/)
|
||||
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include <mpi.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
// Initialize the MPI environment
|
||||
MPI_Init(NULL, NULL);
|
||||
|
||||
// Get the number of processes
|
||||
int world_size;
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
|
||||
|
||||
// Get the rank of the process
|
||||
int world_rank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
|
||||
|
||||
// Get the name of the processor
|
||||
char processor_name[MPI_MAX_PROCESSOR_NAME];
|
||||
int name_len;
|
||||
MPI_Get_processor_name(processor_name, &name_len);
|
||||
|
||||
// Print off a hello world message
|
||||
printf("Hello world from processor %s, rank %d out of %d processors\n",
|
||||
processor_name, world_rank, world_size);
|
||||
|
||||
// Finalize the MPI environment.
|
||||
MPI_Finalize();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
add_executable(jf-live-daq-tests main.cpp)
|
||||
|
||||
target_link_libraries(jf-live-daq-tests
|
||||
jf-live-daq-lib
|
||||
hdf5
|
||||
hdf5_hl
|
||||
hdf5_cpp
|
||||
zmq
|
||||
gtest
|
||||
)
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
Reference in New Issue
Block a user