Skip to content

Commit 6e0de3d

Browse files
Nesterov Alexanderallnes
Nesterov Alexander
authored andcommitted
Initial commit
0 parents  commit 6e0de3d

11 files changed

+132
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
mpich

.travis.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
language:
2+
- c++
3+
4+
os:
5+
- linux
6+
7+
compiler:
8+
- gcc
9+
- g++
10+
- clang
11+
12+
before_install:
13+
- test -n $CC && unset CC
14+
15+
install:
16+
- sudo apt-get install libcr-dev mpich2 mpich2-doc
17+
18+
script:
19+
- mkdir build
20+
- cd build
21+
- cmake -D CMAKE_BUILD_TYPE=Release ..
22+
- make -j4
23+
24+
- mpirun -np 4 ./modules/test_task/test_task

CMakeLists.txt

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cmake_minimum_required( VERSION 2.8 )
2+
3+
message( STATUS "MPI_Practical_Course" )
4+
5+
find_package( MPI REQUIRED )
6+
if( MPI_FOUND )
7+
include_directories( ${MPI_INCLUDE_PATH} )
8+
endif( MPI_FOUND )
9+
10+
add_subdirectory(modules)

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# MPI_Practical_Course
2+
[![Build Status](https://travis-ci.com/allnes/MPI_Practical_Course.svg?branch=master)](https://travis-ci.com/allnes/MPI_Practical_Course)
3+
[![Build status](https://ci.appveyor.com/api/projects/status/tnx3p934orsagg28/branch/master?svg=true)](https://ci.appveyor.com/project/allnes/mpi-practical-course/branch/master)

appveyor.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
environment:
2+
matrix:
3+
- CMAKE_GENERATOR: "Visual Studio 11 2012"
4+
BUILD_SHARED_LIBS: ON
5+
ENABLE_MPI: ON
6+
MPI_HOME: "C:/Program Files (x86)/Microsoft SDKs/MPI"
7+
8+
- CMAKE_GENERATOR: "Visual Studio 12 2013"
9+
BUILD_SHARED_LIBS: ON
10+
ENABLE_MPI: ON
11+
MPI_HOME: "C:/Program Files (x86)/Microsoft SDKs/MPI"
12+
13+
- CMAKE_GENERATOR: "Visual Studio 14 2015"
14+
BUILD_SHARED_LIBS: ON
15+
ENABLE_MPI: ON
16+
MPI_HOME: "C:/Program Files (x86)/Microsoft SDKs/MPI"
17+
18+
# - CMAKE_GENERATOR: "Visual Studio 15 2017"
19+
# BUILD_SHARED_LIBS: OFF
20+
# ENABLE_MPI: ON
21+
# MPI_HOME: "C:/Program Files (x86)/Microsoft SDKs/MPI"
22+
23+
configuration:
24+
- Debug
25+
- Release
26+
27+
install:
28+
- ps: Start-FileDownload 'https://download.microsoft.com/download/B/2/E/B2EB83FE-98C2-4156-834A-E1711E6884FB/MSMpiSetup.exe'
29+
- MSMpiSetup.exe -unattend
30+
- set PATH=C:\Program Files\Microsoft MPI\Bin;%PATH%
31+
32+
- ps: Start-FileDownload 'https://download.microsoft.com/download/B/2/E/B2EB83FE-98C2-4156-834A-E1711E6884FB/msmpisdk.msi'
33+
- msmpisdk.msi /passive
34+
35+
build_script:
36+
- cmd: mkdir build
37+
- cmd: cd build
38+
- cmd: cmake -Hsrc -Bbuild -G "%CMAKE_GENERATOR%" ^
39+
-DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% ^
40+
-DENABLE_PYTHON=%ENABLE_PYTHON% ^
41+
-DENABLE_MPI=%ENABLE_MPI% ^
42+
-DMPI_C_INCLUDE_PATH:PATH="%MPI_HOME%/Include" ^
43+
-DMPI_C_LIBRARIES:PATH="%MPI_HOME%/Lib/x86/msmpi.lib" ^
44+
-DMPI_CXX_INCLUDE_PATH:PATH="%MPI_HOME%/Include" ^
45+
-DMPI_CXX_LIBRARIES:PATH="%MPI_HOME%/Lib/x86/msmpi.lib" ..
46+
- cmd: msbuild ALL_BUILD.vcxproj
47+
48+
- cmd: mpiexec.exe -np 4 modules\test_task\%configuration%\test_task.exe

modules/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
add_subdirectory( test_task )
2+
add_subdirectory( task_1 )
3+
add_subdirectory( task_2 )
4+
add_subdirectory( task_3 )

modules/task_1/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
message(STATUS "Task 1")

modules/task_2/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
message(STATUS "Task 2")

modules/task_3/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
message(STATUS "Task 3")

modules/test_task/CMakeLists.txt

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
project( test_task )
2+
3+
message( STATUS "-- " ${PROJECT_NAME} )
4+
add_executable( ${PROJECT_NAME} main.cpp )
5+
6+
if( MPI_COMPILE_FLAGS )
7+
set_target_properties( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}" )
8+
endif( MPI_COMPILE_FLAGS )
9+
10+
if( MPI_LINK_FLAGS )
11+
set_target_properties( ${PROJECT_NAME} PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}" )
12+
endif( MPI_LINK_FLAGS )
13+
14+
target_link_libraries( ${PROJECT_NAME} ${MPI_LIBRARIES} )

modules/test_task/main.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <mpi.h>
2+
#include <iostream>
3+
#include <assert.h>
4+
5+
int main (int argc, char* argv[])
6+
{
7+
int status, rank, size;
8+
status = MPI_Init (&argc, &argv);
9+
assert(status == MPI_SUCCESS);
10+
11+
status = MPI_Comm_rank (MPI_COMM_WORLD, &rank);
12+
assert(status == MPI_SUCCESS);
13+
14+
status = MPI_Comm_size (MPI_COMM_WORLD, &size);
15+
assert(status == MPI_SUCCESS);
16+
17+
std::cout << "Process #" << rank << '\n';
18+
std::cout << "Count process: " << size << '\n';
19+
20+
status = MPI_Finalize();
21+
assert(status == MPI_SUCCESS);
22+
23+
return 0;
24+
}

0 commit comments

Comments
 (0)