Skip to content

Commit

Permalink
Merge Fix CGS logging and update containers
Browse files Browse the repository at this point in the history
This is a small PR which fixes a small problem with the way CGS is logged and updates the containers. Here are the description of the two commits:

### CGS logging
Report subiteration residuals through `iteration_complete` for CGS.

+ Previously, when running the CGS solver for 100 iterations only 50 residuals
would be reported because one loop does two iterations.
+ Currently, the same residual and solution vectors are reported twice as
these are computed only every two iterations (once per loop run).

### Container update
Update the containers with new functionalities.

+ Add Ubuntu 18.04 support for CUDA containers (cuda 9.2 and more supported only).
+ Correctly set the environment variables with CUDA paths
+ Add support for automake, pkg-config and libtool.
+ Add hwloc support and integrate a topology file of the machine. This has to be
done since hwloc has trouble finding CUDA devices inside the container.

### Related PR: #328
  • Loading branch information
tcojean authored Aug 1, 2019
2 parents 260f6ac + 1ed8645 commit 55589f8
Show file tree
Hide file tree
Showing 8 changed files with 227 additions and 41 deletions.
7 changes: 6 additions & 1 deletion core/solver/cgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ void Cgs<ValueType>::apply_impl(const LinOp *b, LinOp *x) const
exec->run(cgs::make_step_2(u.get(), v_hat.get(), q.get(), t.get(),
alpha.get(), rho.get(), gamma.get(),
&stop_status));

++iter;
this->template log<log::Logger::iteration_complete>(this, iter, r.get(),
dense_x);

// alpha = rho / gamma
// q = u - alpha * v_hat
// t = u + q
Expand All @@ -136,7 +141,7 @@ void Cgs<ValueType>::apply_impl(const LinOp *b, LinOp *x) const
// r = r -alpha * t
// x = x + alpha * u_hat

iter += 2;
++iter;
this->template log<log::Logger::iteration_complete>(this, iter, r.get(),
dense_x);
if (stop_criterion->update()
Expand Down
60 changes: 45 additions & 15 deletions dev_tools/containers/ginkgo-cuda-base.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,52 @@
"""
Ginkgo Base image
Contents:
CUDA version set by the user
GNU compilers version set by the user
LLVM/Clang clang-tidy version set by the user
OpenMP latest apt version for Clang+OpenMP
Python 2 and 3 (upstream)
cmake (upstream)
git, openssh, doxygen, curl, valgrind, graphviz, jq latest apt version
iwyu precompiled version 6.0
CUDA version set by the user
GNU compilers version set by the user
LLVM/Clang clang-tidy version set by the user
OpenMP latest apt version for Clang+OpenMP
Python 2 and 3 (upstream)
cmake (upstream)
git, openssh, doxygen, curl, valgrind, graphviz, jq latest apt version
build-essential, automake, pkg-config, libtool, latest apt version
iwyu precompiled version 6.0
"""
# pylint: disable=invalid-name, undefined-variable, used-before-assignment

import os

cuda_version = USERARG.get('cuda', '10.0')

image = 'nvidia/cuda:{}-devel-ubuntu16.04'.format(cuda_version)
Stage0.baseimage(image)
if float(cuda_version) < float(9.2):
image = 'nvidia/cuda:{}-devel-ubuntu16.04'.format(cuda_version)
Stage0.baseimage(image)
else:
image = 'nvidia/cuda:{}-devel-ubuntu18.04'.format(cuda_version)
Stage0.baseimage(image)


# Correctly set the LIBRARY_PATH
Stage0 += environment(variables={'CUDA_INSTALL_PATH': '/usr/local/cuda/'})
Stage0 += environment(variables={'CUDA_PATH': '/usr/local/cuda/'})
Stage0 += environment(variables={'CUDA_ROOT': '/usr/local/cuda/'})
Stage0 += environment(variables={'CUDA_SDK': '/usr/local/cuda/'})
Stage0 += environment(variables={'CUDA_INC_PATH': '/usr/local/cuda/include'})
Stage0 += environment(variables={'PATH': '$PATH:/usr/local/cuda/bin'})
Stage0 += environment(variables={'LIBRARY_PATH': '$LIBRARY_PATH:/usr/local/cuda/lib64/stubs'})
Stage0 += environment(variables={'LD_LIBRARY_PATH': '$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs'})
Stage0 += environment(variables={'LD_RUN_PATH': 'usr/local/cuda/lib64/stubs'})
Stage0 += environment(variables={'INCLUDEPATH': '/usr/local/cuda/include'})
Stage0 += environment(variables={'CPATH': '/usr/local/cuda/include'})
Stage0 += environment(variables={'MANPATH': '/usr/local/cuda/doc/man'})


# Setup extra tools
Stage0 += python()
Stage0 += cmake(eula=True)
Stage0 += apt_get(ospackages=['git', 'openssh-client', 'doxygen', 'curl', 'valgrind', 'graphviz'])
Stage0 += apt_get(ospackages=['jq', 'iwyu'])
Stage0 += apt_get(ospackages=['build-essential', 'automake', 'pkg-config', 'libtool'])


# GNU compilers
gnu_version = USERARG.get('gnu', '7')
Expand All @@ -43,12 +65,20 @@

# IWYU
if os.path.isdir('bin/'):
Stage0 += copy(src='bin/*', dest='/usr/bin/')
Stage0 += copy(src='bin/*', dest='/usr/bin/')

if os.path.isdir('sonar-scanner/'):
Stage0 += copy(src='sonar-scanner/', dest='/')
Stage0 += copy(src='sonar-scanner/', dest='/')

# Correctly set the LIBRARY_PATH
Stage0 += environment(variables={'LIBRARY_PATH': '/usr/local/cuda/lib64/stubs'})
Stage0 += environment(variables={'LD_LIBRARY_PATH': '/usr/local/cuda/lib64/stubs'})
# hwloc
if float(cuda_version) >= float(9.2):
Stage0 += shell(commands=['cd /var/tmp',
'git clone https://github.com/open-mpi/hwloc.git hwloc'])
Stage0 += shell(commands=['cd /var/tmp/hwloc', './autogen.sh',
'./configure --prefix=/usr --disable-nvml', 'make -j10', 'make install'])

# upload valid FineCI topology and set it for hwloc
if os.path.isfile('topology/fineci.xml'):
Stage0 += copy(src='topology/fineci.xml', dest='/')
Stage0 += environment(variables={'HWLOC_XMLFILE': '/fineci.xml'})
Stage0 += environment(variables={'HWLOC_THISSYSTEM': '1'})
24 changes: 13 additions & 11 deletions dev_tools/containers/ginkgo-nocuda-base.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
"""
Ginkgo Base image
Contents:
GNU compilers version set by the user
LLVM/Clang version set by the user
OpenMP latest apt version for Clang+OpenMP
Python 2 and 3 (upstream)
cmake (upstream)
build-essential, git, openssh, doxygen, curl, valgrind latest apt version
jq, graphviz, ghostscript, texlive, texlive-latex-extra, latest apt version
texlive-science, texlive-fonts-extra, texlive-publishers latest apt version
clang-tidy, iwyu: latest apt version
papi: adds package libpfm4, and copy precompiled papi headers and files
from a directory called 'papi'
GNU compilers version set by the user
LLVM/Clang version set by the user
OpenMP latest apt version for Clang+OpenMP
Python 2 and 3 (upstream)
cmake (upstream)
build-essential, git, openssh, doxygen, curl, valgrind latest apt version
jq, graphviz, ghostscript, texlive, texlive-latex-extra, latest apt version
texlive-science, texlive-fonts-extra, texlive-publishers latest apt version
clang-tidy, iwyu: latest apt version
hwloc, libhwloc-dev, pkg-config latest apt version
papi: adds package libpfm4, and copy precompiled papi headers and files
from a directory called 'papi'
"""
# pylint: disable=invalid-name, undefined-variable, used-before-assignment

Expand All @@ -27,6 +28,7 @@
Stage0 += apt_get(ospackages=['jq', 'graphviz', 'ghostscript', 'texlive', 'texlive-latex-extra'])
Stage0 += apt_get(ospackages=['texlive-science', 'texlive-fonts-extra', 'texlive-publishers'])
Stage0 += apt_get(ospackages=['clang-tidy', 'iwyu'])
Stage0 += apt_get(ospackages=['hwloc', 'libhwloc-dev', 'pkg-config'])

# GNU compilers
gnu_version = USERARG.get('gnu', '8')
Expand Down
49 changes: 46 additions & 3 deletions dev_tools/containers/gko-cuda100-gnu7-llvm60.baseimage
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
FROM nvidia/cuda:10.0-devel-ubuntu16.04 AS stage0
FROM nvidia/cuda:10.0-devel-ubuntu18.04 AS stage0

ENV CUDA_INSTALL_PATH=/usr/local/cuda/

ENV CUDA_PATH=/usr/local/cuda/

ENV CUDA_ROOT=/usr/local/cuda/

ENV CUDA_SDK=/usr/local/cuda/

ENV CUDA_INC_PATH=/usr/local/cuda/include

ENV PATH=$PATH:/usr/local/cuda/bin

ENV LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda/lib64/stubs

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs

ENV LD_RUN_PATH=usr/local/cuda/lib64/stubs

ENV INCLUDEPATH=/usr/local/cuda/include

ENV CPATH=/usr/local/cuda/include

ENV MANPATH=/usr/local/cuda/doc/man

# Python
RUN apt-get update -y && \
Expand Down Expand Up @@ -32,6 +56,14 @@ RUN apt-get update -y && \
iwyu && \
rm -rf /var/lib/apt/lists/*

RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
build-essential \
automake \
pkg-config \
libtool && \
rm -rf /var/lib/apt/lists/*

# GNU compiler
RUN apt-get update -y && \
apt-get install -y --no-install-recommends software-properties-common && \
Expand Down Expand Up @@ -73,8 +105,19 @@ COPY bin/* /usr/bin/

COPY sonar-scanner/ /

ENV LIBRARY_PATH=/usr/local/cuda/lib64/stubs
RUN cd /var/tmp && \
git clone https://github.com/open-mpi/hwloc.git hwloc

RUN cd /var/tmp/hwloc && \
./autogen.sh && \
./configure --prefix=/usr --disable-nvml && \
make -j10 && \
make install

COPY topology/fineci.xml /

ENV HWLOC_XMLFILE=/fineci.xml

ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs
ENV HWLOC_THISSYSTEM=1


36 changes: 32 additions & 4 deletions dev_tools/containers/gko-cuda90-gnu5-llvm39.baseimage
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
FROM nvidia/cuda:9.0-devel-ubuntu16.04 AS stage0

ENV CUDA_INSTALL_PATH=/usr/local/cuda/

ENV CUDA_PATH=/usr/local/cuda/

ENV CUDA_ROOT=/usr/local/cuda/

ENV CUDA_SDK=/usr/local/cuda/

ENV CUDA_INC_PATH=/usr/local/cuda/include

ENV PATH=$PATH:/usr/local/cuda/bin

ENV LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda/lib64/stubs

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs

ENV LD_RUN_PATH=usr/local/cuda/lib64/stubs

ENV INCLUDEPATH=/usr/local/cuda/include

ENV CPATH=/usr/local/cuda/include

ENV MANPATH=/usr/local/cuda/doc/man

# Python
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -32,6 +56,14 @@ RUN apt-get update -y && \
iwyu && \
rm -rf /var/lib/apt/lists/*

RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
build-essential \
automake \
pkg-config \
libtool && \
rm -rf /var/lib/apt/lists/*

# GNU compiler
RUN apt-get update -y && \
apt-get install -y --no-install-recommends software-properties-common && \
Expand Down Expand Up @@ -73,8 +105,4 @@ COPY bin/* /usr/bin/

COPY sonar-scanner/ /

ENV LIBRARY_PATH=/usr/local/cuda/lib64/stubs

ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs


36 changes: 32 additions & 4 deletions dev_tools/containers/gko-cuda91-gnu6-llvm40.baseimage
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
FROM nvidia/cuda:9.1-devel-ubuntu16.04 AS stage0

ENV CUDA_INSTALL_PATH=/usr/local/cuda/

ENV CUDA_PATH=/usr/local/cuda/

ENV CUDA_ROOT=/usr/local/cuda/

ENV CUDA_SDK=/usr/local/cuda/

ENV CUDA_INC_PATH=/usr/local/cuda/include

ENV PATH=$PATH:/usr/local/cuda/bin

ENV LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda/lib64/stubs

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs

ENV LD_RUN_PATH=usr/local/cuda/lib64/stubs

ENV INCLUDEPATH=/usr/local/cuda/include

ENV CPATH=/usr/local/cuda/include

ENV MANPATH=/usr/local/cuda/doc/man

# Python
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -32,6 +56,14 @@ RUN apt-get update -y && \
iwyu && \
rm -rf /var/lib/apt/lists/*

RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
build-essential \
automake \
pkg-config \
libtool && \
rm -rf /var/lib/apt/lists/*

# GNU compiler
RUN apt-get update -y && \
apt-get install -y --no-install-recommends software-properties-common && \
Expand Down Expand Up @@ -73,8 +105,4 @@ COPY bin/* /usr/bin/

COPY sonar-scanner/ /

ENV LIBRARY_PATH=/usr/local/cuda/lib64/stubs

ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs


49 changes: 46 additions & 3 deletions dev_tools/containers/gko-cuda92-gnu7-llvm50.baseimage
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
FROM nvidia/cuda:9.2-devel-ubuntu16.04 AS stage0
FROM nvidia/cuda:9.2-devel-ubuntu18.04 AS stage0

ENV CUDA_INSTALL_PATH=/usr/local/cuda/

ENV CUDA_PATH=/usr/local/cuda/

ENV CUDA_ROOT=/usr/local/cuda/

ENV CUDA_SDK=/usr/local/cuda/

ENV CUDA_INC_PATH=/usr/local/cuda/include

ENV PATH=$PATH:/usr/local/cuda/bin

ENV LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda/lib64/stubs

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs

ENV LD_RUN_PATH=usr/local/cuda/lib64/stubs

ENV INCLUDEPATH=/usr/local/cuda/include

ENV CPATH=/usr/local/cuda/include

ENV MANPATH=/usr/local/cuda/doc/man

# Python
RUN apt-get update -y && \
Expand Down Expand Up @@ -32,6 +56,14 @@ RUN apt-get update -y && \
iwyu && \
rm -rf /var/lib/apt/lists/*

RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
build-essential \
automake \
pkg-config \
libtool && \
rm -rf /var/lib/apt/lists/*

# GNU compiler
RUN apt-get update -y && \
apt-get install -y --no-install-recommends software-properties-common && \
Expand Down Expand Up @@ -73,8 +105,19 @@ COPY bin/* /usr/bin/

COPY sonar-scanner/ /

ENV LIBRARY_PATH=/usr/local/cuda/lib64/stubs
RUN cd /var/tmp && \
git clone https://github.com/open-mpi/hwloc.git hwloc

RUN cd /var/tmp/hwloc && \
./autogen.sh && \
./configure --prefix=/usr --disable-nvml && \
make -j10 && \
make install

COPY topology/fineci.xml /

ENV HWLOC_XMLFILE=/fineci.xml

ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs
ENV HWLOC_THISSYSTEM=1


Loading

0 comments on commit 55589f8

Please sign in to comment.