Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-rc.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-zero committed Nov 14, 2018
2 parents fbfce30 + ab16dd0 commit 3b5a263
Show file tree
Hide file tree
Showing 196 changed files with 8,824 additions and 6,252 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 120
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.travis.yml export-ignore
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
A clear and concise description of what the bug is, including the stacktrace (if there was one).

**To Reproduce**
Steps to reproduce the behavior:
1. Built with the command: '...'
2. Run like this: '....'
3. On the architecture/host/platform: '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Environment:**
- Operating system & version
- Compiler vendor & version
- Build environment (make or cmake)
- Configuration of DBCSR (either the cmake flags or the `Makefile.inc`)
- MPI implementation and version
- If CUDA is being used: CUDA version and GPU architecture
- BLAS/LAPACK implementation and version
- If applicable: Runtime information (how many nodes, type of nodes, ...)
19 changes: 9 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# ignore project specific locations & files
lib/
obj/
bin/
doc/
src/acc/libsmm_acc/libcusmm/parameters.h
src/acc/libsmm_acc/libcusmm/cusmm_kernels.h
src/acc/libsmm_acc/libcusmm/libcusmm_parameters_utils.so
install/
examples/*.x
/lib/
/obj/
/bin/
/doc/
/src/acc/libsmm_acc/libcusmm/parameters.h
/src/acc/libsmm_acc/libcusmm/cusmm_kernels.h
/src/acc/libsmm_acc/libcusmm/libcusmm_parameters_utils.so
/install/
*.callgraph

# exclude personal makefile
Makefile.inc.*
/Makefile.inc.*

# The following covers some more,
# Created by https://www.gitignore.io/api/vim,emacs,python,fortran
Expand Down
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exclude: '^tools/(prettify/fprettify|build_utils/fypp)'
fail_fast: false
repos:
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.24.0
hooks:
- id: yapf
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
hooks:
- id: flake8
3 changes: 3 additions & 0 deletions .style.yapf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[style]
based_on_style = pep8
column_limit = 120
153 changes: 107 additions & 46 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,126 @@ language: c
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- ubuntu-toolchain-r-test
packages:
- gfortran
- libblas-dev
- liblapack-dev
- libopenmpi-dev
- openmpi-bin
- gfortran
- libblas-dev
- liblapack-dev
- libopenmpi-dev
- openmpi-bin
homebrew:
packages:
- cmake

cache:
pip: true
directories:
- $HOME/deps

env:
global:
- LIBXSMM_VERSION=1.10
- CMAKE_VERSION=3.10.3

install:
# Update cmake to the minimal required version (shamelessly copied from the boost travis config):
- DEPS_DIR="${HOME}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.tar.gz"
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
else
brew install cmake || brew upgrade cmake
if [[ "${TRAVIS_OS_NAME}" == "linux" ]] ; then
CMAKE_URL="https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
CMAKE_DIR="cmake-${CMAKE_VERSION}"
if [[ ! -e "${CMAKE_DIR}" ]] ; then
rm -rf cmake-*
mkdir "${CMAKE_DIR}"
travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C "${CMAKE_DIR}"
fi
export PATH=${DEPS_DIR}/${CMAKE_DIR}/bin:${PATH}
fi
- cmake --version
- |
LIBXSMM_URL="https://github.com/hfp/libxsmm/archive/${LIBXSMM_VERSION}.tar.gz"
LIBXSMM_DIR="libxsmm-${LIBXSMM_VERSION}"
if [[ ! -e "${LIBXSMM_DIR}" ]] ; then
rm -rf libxsmm-*
mkdir "${LIBXSMM_DIR}"
travis_retry wget --no-check-certificate --quiet -O - ${LIBXSMM_URL} | tar --strip-components=1 -xz -C "${LIBXSMM_DIR}"
make -C "${LIBXSMM_DIR}" -j
fi
export PKG_CONFIG_PATH=${DEPS_DIR}/${LIBXSMM_DIR}/lib
- pkg-config libxsmm --exists

before_script:
# make sure we are back into the top directory again
- cd "${TRAVIS_BUILD_DIR}"
- export PATH=$HOME/.local/bin:$PATH
- pip install --user git-archive-all pre-commit

jobs:
include:
- stage: build
name: "Build and test MPI+OpenMP version with make"
script:
- make -j FC="mpif90" LD="mpif90" OPTFLAGS="-fprofile-arcs -ftest-coverage -O0 -D__MPI_VERSION=2" all
- make test
- bash <(curl -s https://codecov.io/bash)
- # run this in parallel with the other builds
name: "Build and test MPI+OpenMP version with cmake"
script:
- mkdir -p build
- cd build
# C++ example fails with this ancient version of MPI,
# we see all system CPUs, but can use only 1, causing nproc auto-detection to fail
- cmake -DCMAKE_BUILD_TYPE=Coverage -DWITH_EXAMPLES=OFF -DTEST_MPI_RANKS=1 ..
- make -j
- make CTEST_OUTPUT_ON_FAILURE=1 test
- # run this in parallel with the other builds
name: "Build and test OpenMP version with cmake"
script:
- mkdir -p build
- cd build
# all examples need MPI atm
- cmake -DCMAKE_BUILD_TYPE=Coverage -DUSE_MPI=OFF -DWITH_EXAMPLES=OFF ..
- make -j
- make CTEST_OUTPUT_ON_FAILURE=1 test
- # run this in parallel with the other builds
name: "Build and test MPI version with cmake"
script:
- mkdir -p build
- cd build
# all examples need MPI atm
- cmake -DCMAKE_BUILD_TYPE=Coverage -DUSE_OPENMP=OFF -DWITH_EXAMPLES=OFF -DTEST_MPI_RANKS=1 ..
- make -j
- make CTEST_OUTPUT_ON_FAILURE=1 test
- stage: build
name: "Build and test MPI+OpenMP version with make"
script:
- make -j FC="mpif90" LD="mpif90" OPTFLAGS="-fprofile-arcs -ftest-coverage -O0 -D__MPI_VERSION=2" all
- make test
- bash <(curl -s https://codecov.io/bash)
- # run this in parallel with the other builds
name: "Build and test MPI+OpenMP version with cmake"
script:
- mkdir -p build
- cd build
# C++ example fails with this ancient version of MPI,
# we see all system CPUs, but can use only 1, causing nproc auto-detection to fail
- cmake -DCMAKE_BUILD_TYPE=Coverage -DTEST_MPI_RANKS=1 ..
- make -j
- make CTEST_OUTPUT_ON_FAILURE=1 test
- # run this in parallel with the other builds
name: "Build and test OpenMP version with cmake"
script:
- mkdir -p build
- cd build
# all examples need MPI atm
- cmake -DCMAKE_BUILD_TYPE=Coverage -DUSE_MPI=OFF ..
- make -j
- make CTEST_OUTPUT_ON_FAILURE=1 test
- # run this in parallel with the other builds
name: "Build and test OpenMP version with cmake and libxsmm"
script:
- mkdir -p build
- cd build
# all examples need MPI atm
- cmake -DCMAKE_BUILD_TYPE=Coverage -DUSE_MPI=OFF -DUSE_SMM=libxsmm ..
- make -j
- make CTEST_OUTPUT_ON_FAILURE=1 test
- # run this in parallel with the other builds
name: "Build and test MPI version with cmake"
script:
- mkdir -p build
- cd build
# all examples need MPI atm
- cmake -DCMAKE_BUILD_TYPE=Coverage -DUSE_OPENMP=OFF -DTEST_MPI_RANKS=1 ..
- make -j
- make CTEST_OUTPUT_ON_FAILURE=1 test
- # run this in parallel with the other builds
name: "Run pre-commit hook on changed files"
script:
- set -o pipefail
- git diff --name-only --diff-filter=AM HEAD...$TRAVIS_BRANCH | xargs pre-commit run --files
- stage: release
name: "Build release tarball and deploy to GitHub"
if: tag IS present
script:
# do an in-source config for simplicity since we are not building anything here
- cmake .
- make dist
deploy:
provider: releases
api_key: # encrypted token of the `dbcsr` GitHub service user
secure: Bn6fUntJ6ZMiwKF6LQmb0rhMWbCozeeMaw8klKzxQvPnLttufLaKnUbsbWM4ZUEVcNMDlzAF1JRb2hRhpqyK9mcEbUWh5/xUIT5h2BWq8cmf6lfUitEO3kqgE5c0kIs7dFWZb79aiJl9JIiz5o/fyFoYbdL6R9fJYkBpzkCXcq43t60JPtlMo61f70ca819u/fW89tJyeRyw4hSt6isYwjEv3OalQ1wup55bq+kaAnt6nnv5tPRXbPzwoVJ28pbttg/yx8YC34ZEzHtnSos0EmI8u0ruVViwwKBwUfc7uAONFGdTWXdqtKixOPtblu1ij/RlUy1APw88xRNfrFj7HS3Dlct03O3MpA3FrL0w6PR63jBBvSb/uKV8JkzIpLOWgn6pnzzcTmDwsJZnj8OnROSORjN1qSBYrshQmLQzHEq/FZUXqg+s26GKLPtqJzM2Ds8pOWSYZABwNIFbUOXUmpJcmzLkXcIboBp4WTtOc/P4KRpbmewCAANFYSjMUYaHrSXOv6UC4T6uhKQFPkqN213MDB5VJLxFbAR694+oBCrNMG6ki0hdPPA2GKzlXdWrbibxnSBsNEM2nED0+REAqPa47gFt0m+vLj1gX1gL9UkP9iw0GEM4nTUJ02WazMIu6crBkjqeOf7FPWun1doTD38/DCcUJQC9hmnhQ0E6X+8=
skip_cleanup: true
file_glob: true
file: dist/*
draft: true
# the following 2 lines work around an issue in TravisCI with draft=true:
tag_name: $TRAVIS_TAG
target_commitish: $TRAVIS_COMMIT
85 changes: 69 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,68 @@ include(CMakeDependentOption)

option(USE_MPI "Build with MPI support" ON)
option(USE_OPENMP "Build with OpenMP support" ON)
option(WITH_C_API "Build the C API library" ON)
cmake_dependent_option(WITH_C_API "Build the C API (ISO_C_BINDINGS)" ON "USE_MPI" OFF) # the ISO_C_BINDINGS require MPI unconditionally
cmake_dependent_option(WITH_EXAMPLES "Build the examples" ON "USE_MPI" OFF) # all examples require MPI

set(TEST_MPI_RANKS "auto" CACHE STRING "Number of MPI ranks for testing")

set(USE_SMM "blas" CACHE STRING "Small Matrix Multiplication implementation to use (default: blas)")
set_property(CACHE USE_SMM PROPERTY STRINGS blas libxsmm)

option(USE_CUDA "Build with CUDA support" OFF)
cmake_dependent_option(USE_CUBLAS "Build with CUBLAS support" OFF "USE_CUDA" OFF)
set(WITH_GPU "P100" CACHE STRING "Set the CUDA GPU architecture if CUDA is enabled (default: P100)")
set_property(CACHE WITH_GPU PROPERTY STRINGS K20X K40 K80 P100)

enable_language(Fortran)
enable_testing() # enables the `make test` target

if (WITH_C_API AND WITH_EXAMPLES)
set(ENABLED_LANGUAGES Fortran CXX)
else ()
set(ENABLED_LANGUAGES Fortran)
enable_language(CXX)
endif ()

if (USE_CUDA)
enable_language(CXX CUDA)

set(CUDA_ARCH_NUMBER_K20X 35)
set(CUDA_ARCH_NUMBER_K40 35)
set(CUDA_ARCH_NUMBER_K80 37)
set(CUDA_ARCH_NUMBER_P100 60)
set(CUDA_ARCH_NUMBER ${CUDA_ARCH_NUMBER_${WITH_GPU}})
endif ()

enable_language(${ENABLED_LANGUAGES})
enable_testing() # enables the `make test` target

# PACKAGE DISCOVERY:

find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
find_package(PkgConfig)

if (USE_MPI)
find_package(MPI COMPONENTS ${ENABLED_LANGUAGES} REQUIRED)
get_property(REQUIRED_MPI_COMPONENTS GLOBAL PROPERTY ENABLED_LANGUAGES)
find_package(MPI COMPONENTS ${REQUIRED_MPI_COMPONENTS} REQUIRED)
endif ()

if (USE_SMM MATCHES "blas")
message("-- Using BLAS for Small Matrix Multiplication")
elseif (USE_SMM MATCHES "libxsmm")
# rely on pkg-config since it's quiet hard to link against libxsmm properly
pkg_check_modules(deps REQUIRED IMPORTED_TARGET GLOBAL libxsmmf)
message("-- Using libxsmm for Small Matrix Multiplication")
else()
message(FATAL_ERROR "Unknown SMM library specified" )
endif ()

if (USE_CUBLAS)
# the rest of CUDA is detected by enabling the language
find_library(CUBLAS cublas HINT ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
if (NOT CUBLAS)
message(FATAL_ERROR "cuBLAS library not found but support requested")
endif ()
endif ()

if (USE_OPENMP)
find_package(OpenMP REQUIRED)
endif ()

# make sure that the default is a RELEASE
Expand All @@ -43,15 +85,10 @@ endif ()
get_filename_component(Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)

if (Fortran_COMPILER_NAME MATCHES "gfortran.*")
set(CMAKE_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -funroll-loops")
set(CMAKE_CXX_FLAGS_COVERAGE "-O0 -fprofile-arcs -ftest-coverage")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb")
set(CMAKE_Fortran_FLAGS "-ffree-form -ffree-line-length-none -std=f2003")
if (USE_OPENMP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fopenmp")
endif ()
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -funroll-loops")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -ggdb")
set(CMAKE_Fortran_FLAGS_COVERAGE "-O0 -fprofile-arcs -ftest-coverage")
Expand All @@ -60,10 +97,6 @@ elseif (Fortran_COMPILER_NAME MATCHES "ifort.*")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -debug")
set(CMAKE_Fortran_FLAGS "-free -stand f03 -fpp")
if (USE_OPENMP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -openmp")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -openmp")
endif ()
# Disable the line-length-extension warning #5268
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -diag-disable=5268")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -debug")
Expand All @@ -76,10 +109,30 @@ else ()
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g")
endif ()

file(STRINGS VERSION VERSION_INFO)
foreach(line ${VERSION_INFO})
if (${line} MATCHES "^([^#].*)=[ \t]*(.*)$")
set(key ${CMAKE_MATCH_1})
set(value ${CMAKE_MATCH_2})
string(REGEX REPLACE "[ \t\n]+$" "" key "${key}")
string(REGEX REPLACE "[ \t\n]+$" "" value "${value}")
set(VERSION_${key} "${value}")
continue ()
endif ()
endforeach()

add_subdirectory(src)
add_subdirectory(tests)

if (WITH_EXAMPLES)
add_subdirectory(examples)
endif ()

set(ARCHIVE_NAME "${CMAKE_PROJECT_NAME}-${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
add_custom_target(dist
COMMAND ${CMAKE_COMMAND} -E echo "Building distribution: ${ARCHIVE_NAME}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/dist"
COMMAND git archive-all "${CMAKE_BINARY_DIR}/dist/${ARCHIVE_NAME}.tar.gz"
COMMAND ${CMAKE_COMMAND} -E echo "SHA512 Digests:"
COMMAND ${CMAKE_COMMAND} -E sha512sum "${CMAKE_BINARY_DIR}/dist/${ARCHIVE_NAME}.tar.gz"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
Loading

0 comments on commit 3b5a263

Please sign in to comment.