Skip to content

Commit

Permalink
Merge branch 'release/2.0.0-alpha2'
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-zero committed Jun 28, 2019
2 parents 6de25b4 + fa126ce commit 5fbd363
Show file tree
Hide file tree
Showing 96 changed files with 2,930 additions and 1,376 deletions.
37 changes: 24 additions & 13 deletions .ci/daint.cscs.ch/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,46 @@ pipeline {
checkout scm
}
}
stage('build') {
steps {
run_batch("0:15:00")
}
}
stage('test') {
steps {
run_batch("1:00:00")
stage("build and test") {
parallel {
stage("GNU") {
stages {
stage('build') {
steps {
run_batch("0:15:00", "gnu", "build")
}
}
stage('test') {
steps {
run_batch("1:00:00", "gnu", "test")
}
}
}
}
}
}
}
}

def run_batch(timelimit) {
def run_batch(timelimit, environment, task) {
def (account, basename) = env.JOB_NAME.split('/')
def sbatch_script = ".ci/daint.cscs.ch/${environment}.${task}.sh"
def sbatch_out = "sbatch.${env.BUILD_TAG}.${environment}.${task}.out"

// avoid using the shell for variable expansion to
// get the final command displayed in Jenkins
try {
sh """
sbatch --wait \
--time="${timelimit}" \
--account="${account}" \
--job-name="${basename}" \
--output="sbatch.${env.BUILD_TAG}.${env.STAGE_NAME}.out" \
.ci/daint.cscs.ch/${env.STAGE_NAME}.sh
--job-name="${basename}.${environment}.${task}" \
--output="${sbatch_out}" \
${sbatch_script}
"""
}
finally {
echo readFile("sbatch.${env.BUILD_TAG}.${env.STAGE_NAME}.out")
echo readFile("${sbatch_out}")
}
}

Expand Down
8 changes: 6 additions & 2 deletions .ci/daint.cscs.ch/build.sh → .ci/daint.cscs.ch/gnu.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@ set -o pipefail
module swap PrgEnv-cray PrgEnv-gnu
module load daint-gpu cudatoolkit CMake/3.12.0
module unload cray-libsci_acc
module list

set -o xtrace # do not set earlier to avoid noise from module

umask 0002 # make sure group members can access the data

mkdir --mode=0775 -p "${SCRATCH}/${BUILD_TAG}"
cd "${SCRATCH}/${BUILD_TAG}"
mkdir --mode=0775 -p "${SCRATCH}/${BUILD_TAG}.gnu"
cd "${SCRATCH}/${BUILD_TAG}.gnu"

cmake \
-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment \
-DUSE_CUDA=ON \
-DUSE_CUBLAS=ON \
-DWITH_GPU=P100 \
-DBLAS_FOUND=ON -DBLAS_LIBRARIES="-lsci_gnu_mpi_mp" \
-DLAPACK_FOUND=ON -DLAPACK_LIBRARIES="-lsci_gnu_mpi_mp" \
-DMPIEXEC_EXECUTABLE="$(command -v srun)" \
-DTEST_MPI_RANKS=${SLURM_NTASKS} \
-DTEST_OMP_THREADS=${SLURM_CPUS_PER_TASK} \
Expand Down
5 changes: 3 additions & 2 deletions .ci/daint.cscs.ch/test.sh → .ci/daint.cscs.ch/gnu.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ set -o pipefail
module swap PrgEnv-cray PrgEnv-gnu
module load daint-gpu cudatoolkit CMake/3.12.0
module unload cray-libsci_acc
module list

set -o xtrace # do not set earlier to avoid noise from module

umask 0002 # make sure group members can access the data

mkdir --mode=0775 -p "${SCRATCH}/${BUILD_TAG}"
cd "${SCRATCH}/${BUILD_TAG}"
mkdir --mode=0775 -p "${SCRATCH}/${BUILD_TAG}.gnu"
cd "${SCRATCH}/${BUILD_TAG}.gnu"

export CRAY_CUDA_MPS=1 # enable the CUDA proxy for MPI+CUDA
export OMP_PROC_BIND=TRUE # set thread affinity
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ addons:
- gcc
- cmake
- openmpi
update: true

cache:
pip: true
directories:
- $HOME/deps
- $HOME/Library/Caches/Homebrew

env:
global:
Expand Down
61 changes: 4 additions & 57 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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)
set_property(CACHE WITH_GPU PROPERTY STRINGS K20X K40 K80 P100 V100)

enable_language(Fortran)
enable_testing() # enables the `make test` target
Expand All @@ -37,6 +37,7 @@ if (USE_CUDA)
set(CUDA_ARCH_NUMBER_K40 35)
set(CUDA_ARCH_NUMBER_K80 37)
set(CUDA_ARCH_NUMBER_P100 60)
set(CUDA_ARCH_NUMBER_V100 70)
set(CUDA_ARCH_NUMBER ${CUDA_ARCH_NUMBER_${WITH_GPU}})

# assume that the backend compiler for nvcc understands the -std=c++11
Expand Down Expand Up @@ -85,62 +86,8 @@ if (NOT CMAKE_BUILD_TYPE)
FORCE)
endif ()

# COMPILER CONFIGURATION:

get_filename_component(Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)

# if the fortran compiler command is a CRAY wrapper, find out what the underlying compiler is
if (Fortran_COMPILER_NAME MATCHES "ftn")
execute_process(COMMAND ftn -craype-verbose OUTPUT_VARIABLE ftn_verbose_OUT ERROR_QUIET)
separate_arguments(ftn_verbose_OUT NATIVE_COMMAND "${ftn_verbose_OUT}")
list(GET ftn_verbose_OUT 0 Fortran_COMPILER_NAME)
endif ()

# Depending on the fortran compiler, set the appropriate compiler flags
if (Fortran_COMPILER_NAME MATCHES "^gfortran.*")
set(CMAKE_CXX_FLAGS "-std=c++11")
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")
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")
set(F2008_COMPILER_FLAGS "-std=f2008ts")

# on Apple we may compile with GCC Fortran, but build/link C/C++ code with Apple's clang, requiring special treatment
if (APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
if (CMAKE_BUILD_TYPE MATCHES Coverage)
# when building with coverage suppport, shared libs/executables must be explicitly linked to avoid undefined symbols
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov --coverage")
endif ()
endif ()
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")
# Disable the line-length-extension warning #5268
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -diag-disable=5268")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -debug")
set(F2008_COMPILER_FLAGS "-stand f08")
elseif (Fortran_COMPILER_NAME MATCHES "^pgf.*")
set(CMAKE_CXX_FLAGS_RELEASE "-fast")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_Fortran_FLAGS "-Mfreeform -Mextend -Mallocatable=03")
set(CMAKE_Fortran_FLAGS_RELEASE "-fast")
set(CMAKE_Fortran_FLAGS_DEBUG "-g")
set(F2008_COMPILER_FLAGS "")
else ()
message(WARNING "\
Unknown compiler, trying with just '-O2'/'-O0 -g'.\n\
You will most likely have to pass additonal options for free-form Fortran 2003/2008 for your compiler!\n\
Please open an issue at https://github.com/cp2k/dbcsr/issues with the reported compiler name and the required flags.")
message("-- Fortran_COMPILER_NAME: " ${Fortran_COMPILER_NAME})
message("-- CMAKE_Fortran_COMPILER full path: " ${CMAKE_Fortran_COMPILER})

set(CMAKE_Fortran_FLAGS_RELEASE "-O2")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g")
endif ()
include(CompilerConfiguration)
include(CheckCompilerSupport)

file(STRINGS VERSION VERSION_INFO)
foreach(line ${VERSION_INFO})
Expand Down
19 changes: 11 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ LIBNAME := dbcsr
LIBRARY := lib$(LIBNAME)
default_target: $(LIBRARY)

# Check if FYPP is available ===============================================
ifeq (, $(shell which $(FYPPEXE) 2>/dev/null ))
$(error "No FYPP submodule available, please read README.md on how to properly download DBCSR")
endif

# Read the configuration ====================================================
MODDEPS = "lower"
include $(INCLUDEMAKE)
Expand All @@ -50,7 +45,9 @@ else ifeq ($(GPUVER),K80)
ARCH_NUMBER = 37
else ifeq ($(GPUVER),P100)
ARCH_NUMBER = 60
else ifeq ($(GPUVER),) # Default to the newest GPU
else ifeq ($(GPUVER),V100)
ARCH_NUMBER = 70
else ifeq ($(GPUVER),) # Default to the P100
ARCH_NUMBER = 60
else
$(error GPUVER not recognized)
Expand Down Expand Up @@ -233,6 +230,12 @@ OTHER_HELP += "toolflags : Print flags used with build tools"

else
# stage 2: Include $(OBJDIR)/all.dep, expand target all, and get list of dependencies.

# Check if FYPP is available ===============================================
ifeq (, $(shell which $(FYPPEXE) 2>/dev/null ))
$(error "No FYPP submodule available, please read README.md on how to properly download DBCSR")
endif

all: $(foreach e, $(BIN_NAMES), $(e))

ifeq ($(BIN_NAME),)
Expand Down Expand Up @@ -494,7 +497,7 @@ FYPPFLAGS ?= -n
$(CXX) -c $(CXXFLAGS) $<

libcusmm.o: libcusmm.cpp parameters.h cusmm_kernels.h
$(CXX) -c $(CXXFLAGS) $(CXXOMPFLAGS) -DARCH_NUMBER=$(ARCH_NUMBER) $<
$(CXX) -c $(CXXFLAGS) -DARCH_NUMBER=$(ARCH_NUMBER) $<

%.o: %.cu
$(NVCC) -c $(NVFLAGS) -I'$(SRCDIR)' $<
Expand All @@ -505,7 +508,7 @@ libcusmm_benchmark.o: libcusmm_benchmark.cu parameters.h
$(LIBDIR)/%:
ifneq ($(LD_SHARED),)
@echo "Creating shared library $@"
@$(LD_SHARED) -o $(@:.a=.so) $^
@$(LD_SHARED) $(LDFLAGS) -o $(@:.a=.so) $^ $(LIBS)
else
@echo "Updating archive $@"
@$(AR) $@ $?
Expand Down
16 changes: 3 additions & 13 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# a) set the NVCC variable, e.g. NVCC = nvcc
# b) specify -D__DBCSR_ACC in FCFLAGS variable
# c) set the GPUVER variable, e.g. GPUVER = P100 for P100 card
# (possible values are K20X, K40, K80, P100)
# (possible values are K20X, K40, K80, P100, V100)
# d) set the NVFLAGS variable,
# e.g. NVFLAGS = -O3 -g -w --std=c++11
# in the Makefile, the -arch will be appended with the correct compute version
Expand Down Expand Up @@ -137,7 +137,7 @@ endif

ifneq (0,$(GNU)) # DEFAULT, just edit...
CXXFLAGS += -std=c++11
FCFLAGS += -std=f2003 -ffree-form -fimplicit-none -ffree-line-length-512
FCFLAGS += -std=f2008ts -ffree-form -fimplicit-none -ffree-line-length-512
OPTFLAGS += -O3 -g -fno-omit-frame-pointer -funroll-loops
else
# Intel compiler flags
Expand All @@ -147,7 +147,7 @@ else
endif

ifneq (0,$(OMP)) # using OpenMP
CXXOMPFLAGS = -fopenmp
CXXFLAGS += -fopenmp
FCFLAGS += -fopenmp
endif

Expand All @@ -157,14 +157,6 @@ CXXFLAGS += $(OPTFLAGS)
FCFLAGS += $(OPTFLAGS)
LDFLAGS += $(FCFLAGS)

#######################################################################################
#
# C interface requires new F2008ts standard

ifeq ($(CINT),1)
FCFLAGS := $(subst -std=f2003,-std=f2008ts,$(FCFLAGS))
endif

#######################################################################################
#
# Macro for MPI parallelization.
Expand Down Expand Up @@ -230,7 +222,5 @@ endif
#######################################################################################
#
# Enable for MacOS compilation (-D__ACCELERATE is for Apple Accelerate library)

#FCFLAGS += -D__NO_STATM_ACCESS -D__ACCELERATE

#######################################################################################
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# DBCSR: Distributed Block Compressed Sparse Row matrix library

[![Build Status](https://travis-ci.org/cp2k/dbcsr.svg?branch=develop)](https://travis-ci.org/cp2k/dbcsr) [![codecov](https://codecov.io/gh/cp2k/dbcsr/branch/develop/graph/badge.svg)](https://codecov.io/gh/cp2k/dbcsr)
[![Licence](https://img.shields.io/badge/license-GPL%20v2.0-blue.svg)](./LICENSE)
[![GitHub Releases](https://img.shields.io/github/release-pre/cp2k/dbcsr.svg)](https://github.com/cp2k/dbcsr/releases)

DBCSR is a library designed to efficiently perform sparse matrix matrix multiplication, among other operations.
It is MPI and OpenMP parallel and can exploit GPUs via CUDA.

![DBCSR logo](tools/logo/logo.png)
<p align="center">
<img src="docs/logo/logo.png" width="500">
</p>

## Prerequisites

You absolutely need:

* GNU make
* a Fortran compiler which supports at least Fortran 2003 (respectively 2008+TS when using the C-bindings)
* a LAPACK implementation (reference, OpenBLAS-bundled and MKL have been tested)
* a Fortran compiler which supports at least Fortran 2008 (including the TS 29113 when using the C-bindings)
* a LAPACK implementation (reference, OpenBLAS-bundled and MKL have been tested. Note: DBCSR linked to OpenBLAS 0.3.6 gives wrong results on Power9 architectures.)
* a BLAS implementation (reference, OpenBLAS-bundled and MKL have been tested)
* a Python version installed (2.7 or 3.6+ have been tested) with Numpy

Expand Down Expand Up @@ -71,10 +75,19 @@ The configuration flags are (default first):
-DUSE_OPENMP=<ON|OFF>
-DUSE_SMM=<blas|libxsmm>
-DUSE_CUDA=<OFF|ON>
-DUSE_CUBLAS=<OFF|ON>
-DWITH_C_API=<ON|OFF>
-DWITH_EXAMPLES=<ON|OFF>
-DWITH_GPU=<P100|K20X|K40|K80>
-DWITH_GPU=<P100|K20X|K40|K80|V100>
-DTEST_MPI_RANKS=<auto,N>
-DTEST_OMP_THREADS=<2,N>
-DCMAKE_BUILD_TYPE=<Release|Debug|Coverage>


Building on Cray requires an additional flag to make sure CMake is able to properly
detect the compiler behind the compiler wrappers:

-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment

## Contributing to DBCSR

Expand Down
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MAJOR = 2
MINOR = 0
PATCH = 0-alpha1
PATCH = 0-alpha2
# A specific DATE (YYYY-MM-DD) fixes an official release, otherwise
# it is considered Development version.
DATE = 2019-04-16
DATE = 2019-06-28
20 changes: 20 additions & 0 deletions cmake/CheckCompilerSupport.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

include(CheckFortranSourceCompiles)

set(CHECK_PROGRAMS
f2008-norm2.f90
f2008-block_construct.f90
f2008-contiguous.f90
)

foreach (prog ${CHECK_PROGRAMS})
get_filename_component(prog_ext ${prog} EXT) # get the src extension to pass along
get_filename_component(prog_name ${prog} NAME_WE)

file(READ "${CMAKE_CURRENT_LIST_DIR}/compiler-tests/${prog}" prog_src)
check_fortran_source_compiles("${prog_src}" "${prog_name}" SRC_EXT "${prog_ext}")

if (NOT ${prog_name})
message(FATAL_ERROR "Your compiler does not support all required F2008 features")
endif ()
endforeach ()
Loading

0 comments on commit 5fbd363

Please sign in to comment.