-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2886df
commit 3132172
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fsanitize=leak") | ||
add_executable(hello hello.c) | ||
target_link_libraries(hello ${MPI_LIBRARIES}) | ||
target_include_directories(hello PRIVATE ${MPI_INCLUDE_PATH}) | ||
# find executable path | ||
# add test to run the executable with mpirun | ||
#add_test(NAME Unit-test COMMAND "srun" "${CMAKE_BINARY_DIR}/unit-test/hello") | ||
add_test(NAME Unit-test COMMAND "mpirun" "${CMAKE_BINARY_DIR}/unit-test/hello") | ||
set_property(TEST Unit-test PROPERTY ENVIRONMENT LD_PRELOAD=/leonardo/home/userinternal/amonteru/countdown/build/src/libcntd.so) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Mpi hello world program | ||
//#include "mpe_log.h" | ||
#include <stdio.h> | ||
#include <mpi.h> | ||
|
||
int main() { | ||
int rank, size; | ||
int event1, event2; | ||
|
||
MPI_Init(NULL, NULL); | ||
|
||
MPI_Comm_rank(MPI_COMM_WORLD, &rank); | ||
MPI_Comm_size(MPI_COMM_WORLD, &size); | ||
|
||
printf("Hello world from rank %d of %d\n", rank, size); | ||
|
||
MPI_Finalize(); | ||
return 0; | ||
} |