Skip to content

Commit

Permalink
Update master branch for first prototyp release (#2)
Browse files Browse the repository at this point in the history
* Ir (#1)

* update script, needs refactoring

* update

* fix benchmark

* run at least for 10 ts

* rename GKOBase to GKOlduBase

* create ldu and Ldu matrices

* add ldu GKOCG and GKOBiCGStab

* add Ldu matrix

* add asymetric solver

* clean up

* start implementing of stopping criteria

* add common file

* update common

* inject c++14

* update

* use modified boxTurb16 case

* update benchmark

* keep CF constant

* start reuse sorting idx

* add IR solver, make sorting optional

* add line buffering, further cli args

* Add basic implementation of storing sorting idxs

* add IR implementation

* make sorting default

* store gkomatrix

* add common.C

* make executor an IOPtr

* prepare for forHLR test

* fix block clean for different block start syntax

* transfer to desktop

* hardcoded stored omp executor

* load different executor

* fix min/maxIter bug

* debug reference executor issue

* add clang format to keep formating constant

* fix cuda executor

* clean up

* clean up

* remove unneeded bash benchmark script

* format + prepare preconditioner

* run omp benchmarks for different number of threads

* make pressure solver settings compatible with OF8

* changed size of cases

* fix benchmarking folders

* set dns case boundaries to walls

* Fix several compiler warnings, reordering issues,

* create additional executor to force eager copy

* log succes state of run, keep retrying on failure at least for now

* move OpenFoam stopping criterion to separate file

* Use Foam switches to read dictionary entries

* Make export system a free function, clean logger and imports

* Move IterationLogger to common.H

* Fix execution if sysMatrix is not stored

if sysMatrix is not stored and thus the gkomatrix_ptr==NULL the system
matrix is recreated

* fix loop ctr

* Fix IR solver

- initialize IR with CG
- remove BJ for now

* Add Solver classes to distinguish between OF and GKO solvers, set time out for runs, fix log files

* fix formating

* Fix typos in smoothSolver class

* Fix int to unsingned long conversion

* Add initial CMakeLists file

* Add basic cmake files

* Fix return type warning

* move setting device_exec to separate function

* add third_party folder

* Update README.md

* Update README.md

* Use FOAM_ enviromental variables

* install libginkgo.so files along with libOGL.so if no external ginkgo is used

* Create a initial cmake.yml file

* clone and source OpenFOAM

* Fix non ascii symbol

* display OpenFOAM folder content

* show content of OpenFOAM-8 folder

* Update cmake.yml

* set OpenFOAM env variables manually

* add build badge

* Update Readme file

* remove Test folder since it is no longer needed

* re-enable exporting the system matrix, rhs and initial guess

* Read maxBlockSize from dictionary

* Rename controlDict_ member variable to dictionary_

* Make BiCGStabFactory consistent with CGFactory

* Clean unneeded comment

* Fix sorting bounds of sorting_idxs

* Update cmake.yml

* add basic travis file

* remove github actions file

* update .travis.yml

* fix OpenFOAM path

* update travis file

* compile full OpenFOAM for now

* install openmpi-dev

* install flexc++

* add OpenFOAM-dev to build matrix

* add fl dev

* install openfoam from the repository

* for now just test if OGL builds

* add build badge

* fix sourcing depending on of version

* switch to ubuntu 20.04

* make OGL_USE_EXTERNAL_GINKGO an option

* use --no-check-certificate since importing the key fails regularily

* pass --no-check-certificate to wget

* fix type of tmp_col_idxs and tmp_row_idxs

* sort the system matrix to avoid  cuda convergence issue

* add preconditioner to path

* remove benchmark script to separate repository

* fix find_package

* Fix find_package execution after external ginkgo was included #5

Co-authored-by: tcojean <[email protected]>

* Add OpenFOAM version shields

Co-authored-by: tcojean <[email protected]>
  • Loading branch information
greole and tcojean authored Apr 20, 2021
1 parent 6b5d768 commit 781cfd1
Show file tree
Hide file tree
Showing 35 changed files with 2,847 additions and 820 deletions.
108 changes: 108 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...

44 changes: 44 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
language: cpp
sudo: true
compiler:
- gcc

dist: focal
os:
- linux

env:
- VERSION=8
- VERSION=7

cache:
directories:
- $HOME/OpenFOAM


addons:
apt:
update: true
packages:
- flexc++
- libfl-dev
- lcov
- libopenmpi-dev

before_install:
- sudo sh -c "wget --no-check-certificate -O - https://dl.openfoam.org/gpg.key | apt-key add -"
- sudo add-apt-repository http://dl.openfoam.org/ubuntu
- sudo apt update

install:
- sudo apt-get -y install openfoam$VERSION
- source /opt/openfoam$VERSION/etc/bashrc

before_script:
- cmake --version
- mkdir build
- cd build
- cmake ..

script:
- make -j4
137 changes: 137 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
cmake_minimum_required(VERSION 3.9)

project(OGL LANGUAGES C CXX DESCRIPTION "A wrapper for Ginkgo solver to provide GPGPU capabilities to OpenFOAM")

if(NOT DEFINED ENV{FOAM_SRC})
message(FATAL_ERROR "You must source OpenFOAM before building OGL")
endif()

# Configuration options

include(cmake/build_type_helpers.cmake)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules/")

include(CheckIncludeFileCXX)
option(OGL_USE_EXTERNAL_GINKGO "Use external ginkgo" FALSE)

include(CheckIncludeFileCXX)
check_include_file_cxx(cxxabi.h GKO_HAVE_CXXABI_H)

include(cmake/package_helpers.cmake)
include(cmake/build_helpers.cmake)
include(cmake/install_helpers.cmake)
ginkgo_find_package(Ginkgo "Ginkgo::ginkgo" FALSE 1.4.0)

add_subdirectory(third_party)

# If ginkgo wasn't found so far look for the third_party installation
if (NOT Ginkgo_FOUND)
find_package(Ginkgo 1.4.0 REQUIRED PATHS ${CMAKE_CURRENT_BINARY_DIR}/third_party/ginkgo/build/install/lib/cmake)
endif()

# To interface with ginkgo at least C++ 14 is needed
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)


set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -O0 -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} \
-Wall -Wpedantic -Wextra -march=native -fopenmp -fPIC"
)

if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} \
-fno-omit-frame-pointer \
-fsanitize=address"
)

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} \
-fno-omit-frame-pointer \
-Rpass=loop-vectorize \
-ffast-math \
"
#-Rpass-analysis=loop-vectorize \
#-Rpass-missed=loop-vectorize \
)

elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")

add_definitions(-DWITH_GNU)

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} \
--coverage\
-fprofile-arcs \
-fsanitize=address \
-ggdb3 \
-ftest-coverage"
)

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} \
-ffast-math \
-march=native \
-ftree-vectorize \
-rdynamic \
"
# -fopt-info-vec-missed"
)
endif()

option(BUILD_SHARED_LIBS "Build shared library" ON)
add_library(OGL "" )

add_compile_definitions(
WM_LABEL_SIZE=32
WM_ARCH_OPTION=64
NoRepository
linux64
WM_DP
)

target_sources(OGL
PRIVATE
lduMatrix/GKOlduBase/GKOlduBase.C
lduMatrix/GKOCG/GKOCG.C
lduMatrix/GKOIR/GKOIR.C
lduMatrix/GKOBiCGStab/GKOBiCGStab.C
LduMatrix/GKOLduBase/GKOLduBase.C
LduMatrix/GKOACG/GKOACG.C
PUBLIC
lduMatrix/GKOlduBase/GKOlduBase.H
lduMatrix/GKOCG/GKOCG.H
lduMatrix/GKOIR/GKOIR.H
lduMatrix/GKOBiCGStab/GKOBiCGStab.H
LduMatrix/GKOLduBase/GKOLduBase.H
LduMatrix/GKOACG/GKOACG.H
)


target_include_directories(OGL
PUBLIC
$ENV{FOAM_SRC}/OpenFOAM/lnInclude
$ENV{FOAM_SRC}/meshTools/lnInclude
$ENV{FOAM_SRC}/finiteVolume/lnInclude
$ENV{FOAM_SRC}/OSspecific/POSIX/lnInclude
common/
lduMatrix/GKOlduBase
LduMatrix/GKOLduBase
)


target_link_libraries(OGL
PUBLIC
Ginkgo::ginkgo
)

install(TARGETS OGL
DESTINATION $ENV{FOAM_USER_LIBBIN}
)

if(NOT ${OGL_USE_EXTERNAL_GINKGO})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/third_party/ginkgo/build/install/lib/
DESTINATION $ENV{FOAM_USER_LIBBIN}
)
endif()

Loading

0 comments on commit 781cfd1

Please sign in to comment.