---
# System prepended metadata

title: HPCC

---

# HPCC
## 上一屆的參考安裝方法
[下載方法一](https://hackmd.io/@tings0802/sc_note/https%3A%2F%2Fhackmd.io%2F%40tings0802%2Ftest2_02#HPCC)
[下載方法二](https://hackmd.io/@tings0802/demon#HPCC-)

我的下載方法
```shell=
# openmpi
cd /
wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.4.tar.gz
tar xvf openmpi-3.1.4.tar.gz
cd openmpi-3.1.4
./configure --prefix=/openmpi
make
make install
export PATH=$PATH:/openmpi/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/openmpi/lib
```
atlas 和 hpcc
```shell=
# atlas
yum install -y atlas
# HPCC
cd /
wget http://icl.cs.utk.edu/projectsfiles/hpcc/download/hpcc-1.5.0.tar.gz
tar -xvf hpcc-1.5.0.tar.gz
# 編譯安裝
cd hpcc-1.5.0/hpl/
cp setup/Make.Linux_ATHLON_CBLAS ./Make.Linux
vim Make.Linux
```
Make.Linux裡面修改參數部分
```shell=
TOPdir       = /hpcc-1.5.0/hpl
MPdir        = /openmpi
MPlib        = $(MPdir)/lib/libmpi.so
LAdir        = /usr/lib64/atlas
LAlib        = $(LAdir)/libsatlas.so.3 $(LAdir)/libtatlas.so.3
CCFLAGS      = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -W -Wall -std=c99
```
```whell=
cd ..
make arch=Linux
```

dockerfile
```shell=
##centos7baseimage
FROM centos:7
##download necessary document
RUN yum -y update && \
    yum -y install gcc-c++ glibc-headers rsh gcc wget  vim  fftw   atlas GNUmake make which locate && \
    yum clean all
WORKDIR /
RUN wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.4.tar.gz && \
    tar xvf openmpi-3.1.4.tar.gz && \
    cd openmpi-3.1.4 && \
    ./configure --prefix=/openmpi && \
    make && \
    make install
ENV PATH=$PATH:/openmpi/bin \
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/openmpi/lib
RUN cd / && \
    wget http://icl.cs.utk.edu/projectsfiles/hpcc/download/hpcc-1.5.0.tar.gz && \
    tar -xvf hpcc-1.5.0.tar.gz && \
    cd hpcc-1.5.0/hpl/ && \
    cp setup/Make.Linux_ATHLON_CBLAS ./Make.Linux && \
    sed -ie 's/\..\/..\/../\/hpcc-1.5.0\/hpl/' Make.Linux && \
    sed -ie 's/\/usr\/local\/mpi/\/openmpi/' Make.Linux && \ 
    sed -ie 's/\$(MPdir)\/lib\/libmpich.a/\$(MPdir)\/lib\/libmpi.so/' Make.Linux && \
    sed -ie 's/\$(HOME)\/netlib\/ARCHIVES\/Linux_ATHLON/\/usr\/lib64\/atlas/' Make.Linux && \
    sed -ie 's/\$(LAdir)\/libcblas.a \$(LAdir)\/libatlas.a/\$(LAdir)\/libsatlas.so.3 \$(LAdir)\/libtatlas.so.3/' Make.Linux && \
    sed -ie 's/$(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -W -Wall/$(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -W -Wall -std=c99/' Make.Linux && \
    cd .. && \
    make arch=Linux
CMD ["/bin/bash"] 
```
* sed 用法
    * [sed 鳥哥](http://linux.vbird.org/linux_basic/0330regularex.php#sed)
    * [sed replace path](https://stackoverflow.com/questions/45347077/use-sed-in-docker-to-replace-path)

用 singularity python 轉變的 singularity def檔為下
```shell=
Bootstrap: docker
From: centos:7
Stage: spython-base

%post
##centos7baseimage
##download necessary document
yum -y update && \
yum -y install gcc-c++ glibc-headers gcc rsh wget  vim  fftw   atlas GNUmake make which locate && \
yum clean all
cd /
wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.4.tar.gz && \
tar xvf openmpi-3.1.4.tar.gz && \
cd openmpi-3.1.4 && \
./configure --prefix=/openmpi && \
make && \
make install
PATH=$PATH:/openmpi/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/openmpi/lib
cd / && \
wget http://icl.cs.utk.edu/projectsfiles/hpcc/download/hpcc-1.5.0.tar.gz && \
tar -xvf hpcc-1.5.0.tar.gz && \
cd hpcc-1.5.0/hpl/ && \
cp setup/Make.Linux_ATHLON_CBLAS ./Make.Linux && \
sed -ie 's/\..\/..\/../\/hpcc-1.5.0\/hpl/' Make.Linux && \
sed -ie 's/\/usr\/local\/mpi/\/openmpi/' Make.Linux && \
sed -ie 's/\$(MPdir)\/lib\/libmpich.a/\$(MPdir)\/lib\/libmpi.so/' Make.Linux && \
sed -ie 's/\$(HOME)\/netlib\/ARCHIVES\/Linux_ATHLON/\/usr\/lib64\/atlas/' Make.Linux && \
sed -ie 's/\$(LAdir)\/libcblas.a \$(LAdir)\/libatlas.a/\$(LAdir)\/libsatlas.so.3 \$(LAdir)\/libtatlas.so.3/' Make.Linux && \
sed -ie 's/$(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -W -Wall/$(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -W -Wall -std=c99/' Make.Linux && \
cd .. && \
make arch=Linux
%environment
export PATH=$PATH:/openmpi/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/openmpi/lib
%runscript
cd /
exec /bin/bash /bin/bash "$@"
%startscript
cd /
exec /bin/bash /bin/bash "$@"

```
## 測試執行
```shell=
cp _hpccinf.txt hpccinf.txt
vim hpccinf.txt
```
```
Ps 1
Qs 核心數
```
```
mpirun -np 2 ./hpcc
```

![](https://i.imgur.com/pcvkW3J.png)
即成功


