forked from At0mn1yIvan/ppc-2023-mpi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Lab3): complete lab 3 global optimizathon
- Loading branch information
1 parent
65b1a24
commit 2041e1c
Showing
5 changed files
with
648 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,38 @@ | ||
FROM ubuntu:latest | ||
|
||
# Устанавливаем зависимости | ||
RUN apt-get update && \ | ||
apt-get upgrade && \ | ||
apt-get install -y software-properties-common && \ | ||
add-apt-repository ppa:ubuntu-toolchain-r/test && \ | ||
apt-get update && \ | ||
apt-get install -y gcc-12 g++-12 cppcheck ninja-build mpich libmpich mpi openmpi-bin libomp-dev python3-pip valgrind | ||
|
||
RUN python3 -m pip install --upgrade pip | ||
RUN python3 -m pip install setuptools cpplint | ||
|
||
# Устанавливаем ccache | ||
RUN apt-get install -y ccache | ||
|
||
# Копируем код проекта внутрь контейнера | ||
COPY . /app | ||
WORKDIR /app | ||
|
||
# Обновляем submodules | ||
RUN git submodule update --init --recursive | ||
|
||
# Выполняем настройку CMake | ||
RUN mkdir build | ||
WORKDIR /app/build | ||
RUN cmake -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -G Ninja -D USE_SEQ=ON -D USE_MPI=ON -D USE_OMP=ON -D USE_TBB=ON -D USE_STD=ON -D CMAKE_BUILD_TYPE=RELEASE .. | ||
WORKDIR /app | ||
|
||
# Собираем проект с помощью Ninja | ||
RUN export PATH="/usr/lib/ccache:$PATH" && cd build && ninja | ||
WORKDIR /app | ||
|
||
# Устанавливаем переменную среды для количества потоков OpenMP | ||
ENV OMP_NUM_THREADS=8 | ||
|
||
# Запускаем скрипт для запуска тестов | ||
CMD ["scripts/run.sh"] |
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,36 @@ | ||
get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME) | ||
enable_testing() | ||
|
||
if( USE_MPI ) | ||
if( UNIX ) | ||
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wno-uninitialized") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-uninitialized") | ||
endif( UNIX ) | ||
|
||
set(ProjectId "${ProjectId}_mpi") | ||
project( ${ProjectId} ) | ||
message( STATUS "-- " ${ProjectId} ) | ||
|
||
file(GLOB_RECURSE header_files "*.h") | ||
file(GLOB_RECURSE source_files "*.cpp") | ||
set(PACK_LIB "${ProjectId}_lib") | ||
add_library(${PACK_LIB} STATIC ${header_files} ${source_files}) | ||
|
||
add_executable( ${ProjectId} ${source_files} ) | ||
|
||
target_link_libraries(${ProjectId} ${PACK_LIB}) | ||
if( MPI_COMPILE_FLAGS ) | ||
set_target_properties( ${ProjectId} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}" ) | ||
endif( MPI_COMPILE_FLAGS ) | ||
|
||
if( MPI_LINK_FLAGS ) | ||
set_target_properties( ${ProjectId} PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}" ) | ||
endif( MPI_LINK_FLAGS ) | ||
target_link_libraries( ${ProjectId} ${MPI_LIBRARIES} ) | ||
target_link_libraries(${ProjectId} gtest gtest_main) | ||
|
||
enable_testing() | ||
add_test(NAME ${ProjectId} COMMAND ${ProjectId}) | ||
else( USE_MPI ) | ||
message( STATUS "-- ${ProjectId} - NOT BUILD!" ) | ||
endif( USE_MPI ) |
Oops, something went wrong.