Skip to content

Commit

Permalink
WIP: update api for python module, drop python2 (#777)
Browse files Browse the repository at this point in the history
* restore Python module
* drop Python2 support
* add ci/cd for Python module
* add Python example Si_dft.py
  • Loading branch information
simonpintarelli authored Nov 11, 2022
1 parent a98b33c commit caa2d2a
Show file tree
Hide file tree
Showing 10 changed files with 8,960 additions and 370 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
container: electronicstructure/sirius
env:
SPEC_GCC: sirius@develop %gcc +tests +apps +vdwxc +scalapack +fortran build_type=RelWithDebInfo ^openblas ^mpich
SPEC_GCC: sirius@develop %gcc +python +tests +apps +vdwxc +scalapack +fortran build_type=RelWithDebInfo ^openblas ^mpich
steps:
- uses: actions/checkout@v2
- name: Show the spec
Expand All @@ -22,7 +22,7 @@ jobs:
cd ${GITHUB_WORKSPACE}
mkdir build
cd build
spack --color always -e gcc-build-env build-env $SPEC_GCC -- cmake .. -DUSE_SCALAPACK=1 -DUSE_VDWXC=1 -DBUILD_TESTING=1 -DCREATE_FORTRAN_BINDINGS=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
spack --color always -e gcc-build-env build-env $SPEC_GCC -- cmake .. -DUSE_SCALAPACK=1 -DUSE_VDWXC=1 -DBUILD_TESTING=1 -DCREATE_FORTRAN_BINDINGS=1 -DCREATE_PYTHON_MODULE=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
- name: Build SIRIUS
run: |
cd ${GITHUB_WORKSPACE}/build
Expand Down
12 changes: 2 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ set(USE_PROFILER ON CACHE BOOL "measure execution of functions with
set(USE_MEMORY_POOL ON CACHE BOOL "use memory pool")
set(USE_POWER_COUNTER OFF CACHE BOOL "measure energy consumption with power counters")
set(BUILD_TESTING OFF CACHE BOOL "build test executables") # override default setting in CTest module
set(PYTHON2 OFF CACHE STRING "use Python 2.7")
set(CUDA_ARCH OFF CACHE STRING "the target GPU architectures; 60 (Pascal), 70 (Volta), etc. Multiple archs are supported too.")
set(GPU_MEMORY_ALIGMENT "512" CACHE STRING "memory alignment of the GPU")
set(USE_FP32 "AUTO" CACHE STRING "Enable single precision support.")
Expand Down Expand Up @@ -72,15 +71,8 @@ include(GitSubmodule) # include custom defined FindPackage modules
include(GNUInstallDirs) # required to get a proper LIBDIR variable

if (CREATE_PYTHON_MODULE)
if(PYTHON2)
# force cmake to use python2
set(PYBIND11_PYTHON_VERSION 2.7)
find_package(Python2 REQUIRED)
set(PYTHON_EXECUTABLE ${Python2_EXECUTABLE})
else()
find_package(Python3 COMPONENTS Interpreter REQUIRED)
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
endif()
find_package(Python3 COMPONENTS Interpreter REQUIRED)
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
endif()

# Set release as the default build type.
Expand Down
29 changes: 15 additions & 14 deletions ci/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nvidia/cuda:11.2.2-devel-ubuntu20.04
FROM nvidia/cuda:11.4.2-devel-ubuntu20.04

ENV DEBIAN_FRONTEND=noninteractive \
PATH="$PATH:/spack/bin"
Expand All @@ -17,15 +17,15 @@ RUN apt-get install -y gcc g++ gfortran clang git make unzip \
patchelf

# install CMake
RUN wget https://github.com/Kitware/CMake/releases/download/v3.24.1/cmake-3.24.1-linux-x86_64.tar.gz -O cmake.tar.gz && \
RUN wget https://github.com/Kitware/CMake/releases/download/v3.24.3/cmake-3.24.3-linux-x86_64.tar.gz -O cmake.tar.gz && \
tar zxvf cmake.tar.gz --strip-components=1 -C /usr

# get latest version of spack
RUN git clone https://github.com/spack/spack.git

# find gcc and clang compilers
RUN /spack/bin/spack compiler find
RUN /spack/bin/spack external find --all
RUN spack compiler find
RUN spack external find --all

# install yq (utility to manipulate the yaml files)
RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_386 && chmod a+x /usr/local/bin/yq
Expand All @@ -37,24 +37,25 @@ RUN yq -i '.compilers[0].compiler.paths.f77 = "/usr/bin/gfortran"' /root/.spack/
yq -i '.compilers[1].compiler.paths.fc = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml

# create GCC build env.
RUN /spack/bin/spack env create --with-view /sirius-install gcc-build-env
RUN spack env create --with-view /sirius-install gcc-build-env

ENV SPEC_GCC="sirius@develop %gcc build_type=Release +scalapack +vdwxc +fortran +tests +nlcglib +elpa +magma +cuda cuda_arch=60 ^openblas ^mpich@3.3.2 ^nlcglib +cuda +wrapper cuda_arch=60 ^kokkos +wrapper cuda_arch=60 ^spfft+single_precision ^magma+cuda cuda_arch=60 target=x86_64"
ENV SPEC_GCC="sirius@develop %gcc build_type=Release +python +scalapack +vdwxc +fortran +tests +nlcglib +elpa +magma +cuda cuda_arch=60 ^openblas ^mpich@3.3.2 ^nlcglib +cuda +wrapper cuda_arch=60 ^kokkos +wrapper cuda_arch=60 ^spfft+single_precision ^magma+cuda cuda_arch=60 target=x86_64"

RUN /spack/bin/spack -e gcc-build-env spec $SPEC_GCC
# show spec.
RUN spack -e gcc-build-env spec $SPEC_GCC

RUN /spack/bin/spack -e gcc-build-env install --fail-fast --only=dependencies $SPEC_GCC
RUN spack -e gcc-build-env add $SPEC_GCC

RUN spack -e gcc-build-env install --fail-fast --only=dependencies

# create clang build env.
RUN /spack/bin/spack env create clang-build-env
RUN spack env create clang-build-env

ENV SPEC_CLANG="sirius@develop %clang build_type=Release +tests ^openblas ^mpich ~fortran ^spfft+single_precision target=x86_64"

RUN /spack/bin/spack -e clang-build-env spec $SPEC_CLANG
RUN spack -e clang-build-env spec $SPEC_CLANG

# install all packages; don't reuse from gcc
RUN /spack/bin/spack -e clang-build-env install --fresh --fail-fast --only=dependencies $SPEC_CLANG
RUN spack -e clang-build-env add $SPEC_CLANG
RUN spack -e clang-build-env install --fresh --fail-fast --only=dependencies

#WORKDIR /root
#
#ENTRYPOINT ["bash", "-l"]
Loading

0 comments on commit caa2d2a

Please sign in to comment.