File tree Expand file tree Collapse file tree 8 files changed +23
-24
lines changed Expand file tree Collapse file tree 8 files changed +23
-24
lines changed Original file line number Diff line number Diff line change 1
- project( mpi_test )
1
+ project( test_mpi )
2
2
3
3
message( STATUS "-- " ${PROJECT_NAME} )
4
4
add_executable( ${PROJECT_NAME} main.cpp )
Original file line number Diff line number Diff line change 1
1
// Copyright 2018 Nesterov Alexander
2
- #include <assert.h>
3
2
#include <mpi.h>
4
- #include <iostream >
3
+ #include <stdio.h >
5
4
6
5
int main(int argc, char* argv[]) {
7
6
int status, rank, size;
@@ -10,12 +9,17 @@ int main(int argc, char* argv[]) {
10
9
11
10
status = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
12
11
if (status != MPI_SUCCESS) { return -1; }
12
+ if (rank == 0) {
13
+ printf("----------------------------------\n");
14
+ printf("MPI Test Program\n");
15
+ printf("----------------------------------\n");
16
+ }
17
+ MPI_Barrier(MPI_COMM_WORLD);
13
18
14
19
status = MPI_Comm_size(MPI_COMM_WORLD, &size);
15
20
if (status != MPI_SUCCESS) { return -1; }
16
21
17
- std::cout << "Process #" << rank << '\n';
18
- std::cout << "Count process: " << size << '\n';
22
+ printf("Process: %d | Count process: %d\n", rank, size);
19
23
20
24
status = MPI_Finalize();
21
25
if (status != MPI_SUCCESS) { return -1; }
Original file line number Diff line number Diff line change 1
- project( omp_test )
1
+ project( test_omp )
2
2
3
3
if ( OpenMP_FOUND )
4
4
message( STATUS "-- " ${PROJECT_NAME} )
Original file line number Diff line number Diff line change 4
4
#include <iostream>
5
5
6
6
int main(int argc, char* argv[]) {
7
+ std::cout << "----------------------------------" << '\n';
8
+ std::cout << "OpenMP Test Program" << '\n';
9
+ std::cout << "----------------------------------" << '\n';
7
10
#pragma omp parallel
8
11
{
9
12
#pragma omp critical
Original file line number Diff line number Diff line change 1
- project( tbb_test )
1
+ project( test_tbb )
2
2
3
3
message( STATUS "-- " ${PROJECT_NAME} )
4
4
add_executable( ${PROJECT_NAME} main.cpp )
Original file line number Diff line number Diff line change 4
4
#include <iostream>
5
5
6
6
int main(int argc, char* argv[]) {
7
+ std::cout << "----------------------------------" << '\n';
8
+ std::cout << "TBB Test Program" << '\n';
9
+ std::cout << "----------------------------------" << '\n';
7
10
tbb::flow::graph g;
8
11
tbb::flow::continue_node< tbb::flow::continue_msg > hello(g,
9
12
[](const tbb::flow::continue_msg &) { std::cout << "Hello"; });
Original file line number Diff line number Diff line change 1
1
@echo off
2
- echo "##########################################"
3
- echo "mpi"
4
- echo "##########################################"
5
- mpiexec.exe -np 4 build\bin\mpi_test.exe
6
-
7
- echo "##########################################"
8
- echo "omp"
9
- echo "##########################################"
10
- build\bin\omp_test.exe
11
-
12
- echo "##########################################"
13
- echo "tbb"
14
- echo "##########################################"
15
- build\bin\tbb_test.exe
2
+ for /r "." %%a in (build\bin\*_mpi.exe) do mpiexec -np 4 %%~fa
3
+ for /r "." %%a in (build\bin\*_omp.exe) do %%~fa
4
+ for /r "." %%a in (build\bin\*_tbb.exe) do %%~fa
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ check_exist_file() {
7
7
echo "##########################################"
8
8
echo "mpi"
9
9
echo "##########################################"
10
- FILE="/build/bin/mpi_test "
10
+ FILE="/build/bin/test_mpi "
11
11
if check_exist_file $FILE;
12
12
then
13
13
mpirun -np 2 .$FILE;
18
18
echo "##########################################"
19
19
echo "omp"
20
20
echo "##########################################"
21
- FILE="/build/bin/omp_test "
21
+ FILE="/build/bin/test_omp "
22
22
if check_exist_file $FILE;
23
23
then
24
24
.$FILE;
29
29
echo "##########################################"
30
30
echo "tbb"
31
31
echo "##########################################"
32
- FILE="/build/bin/tbb_test "
32
+ FILE="/build/bin/test_tbb "
33
33
if check_exist_file $FILE;
34
34
then
35
35
.$FILE;
You can’t perform that action at this time.
0 commit comments