restructure, makefile, switch to nheq apposed to bash

This commit is contained in:
unsalted
2017-03-25 16:26:22 -07:00
parent 4d52b0aa23
commit 13da3c03ce
5 changed files with 216 additions and 26 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
commands.txt

63
CPU/Dockerfile Normal file
View File

@@ -0,0 +1,63 @@
FROM ubuntu:16.04
LABEL maintainer "Unsalted"
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
build-essential \
wget \
g++ \
git \
cmake \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y
WORKDIR /tmp
# set boost envs
ARG boost_version=1.62.0
ARG boost_dir=boost_1_62_0
ARG boost_sha256_sum=440a59f8bc4023dbe6285c9998b0f7fa288468b889746b1ef00e8b36c559dce1
ENV boost_version ${boost_version}
ARG boost_libs=" \
--with-atomic \
--with-chrono \
--with-date_time \
--with-filesystem \
--with-log \
--with-regex \
--with-system \
--with-thread
# install boost
RUN wget http://downloads.sourceforge.net/project/boost/boost/${boost_version}/${boost_dir}.tar.gz \
&& echo "${boost_sha256_sum} ${boost_dir}.tar.gz" | sha256sum -c \
&& tar xfz ${boost_dir}.tar.gz \
&& rm ${boost_dir}.tar.gz \
&& cd ${boost_dir} \
&& ./bootstrap.sh --prefix=/usr \
&& ./b2 -j 4 stage $boost_libs \
&& ./b2 -j 4 install $boost_libs \
&& cd .. && rm -rf ${boost_dir} && ldconfig
# install nicehash
RUN git clone https://github.com/nicehash/nheqminer.git \
&& chmod +x nheqminer/cpu_xenoncat/asm_linux/* \
&& cd nheqminer/cpu_xenoncat/asm_linux \
&& sh assemble.sh \
&& cd /tmp \
&& mkdir build/ \
&& cd build/ \
&& cmake -DUSE_CUDA_DJEZO=OFF ../nheqminer \
&& make -j $(nproc) \
&& cp ./nheqminer /usr/local/bin/nheqminer
RUN rm -rf /tmp/*
RUN useradd -ms /bin/bash nheqminer
USER nheqminer
WORKDIR /home/nheqminer
ENTRYPOINT ["/usr/local/bin/nheqminer"]
CMD ["-h"]

View File

@@ -1,21 +1,25 @@
FROM ubuntu:16.04
FROM nvidia/cuda:8.0-runtime-ubuntu16.04
LABEL maintainer "Unsalted"
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
build-essential \
wget \
g++ \
git \
cmake \
cuda-core-$CUDA_PKG_VERSION \
cuda-misc-headers-$CUDA_PKG_VERSION \
cuda-command-line-tools-$CUDA_PKG_VERSION \
cuda-driver-dev-$CUDA_PKG_VERSION \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y
ENV LIBRARY_PATH /usr/local/cuda/lib64/stubs:${LIBRARY_PATH}
WORKDIR /tmp
# set boost envs
# install boost 1.62+
ARG boost_version=1.62.0
ARG boost_dir=boost_1_62_0
ARG boost_sha256_sum=440a59f8bc4023dbe6285c9998b0f7fa288468b889746b1ef00e8b36c559dce1
@@ -30,8 +34,6 @@ ARG boost_libs=" \
--with-regex \
--with-system \
--with-thread
# install boost
RUN wget http://downloads.sourceforge.net/project/boost/boost/${boost_version}/${boost_dir}.tar.gz \
&& echo "${boost_sha256_sum} ${boost_dir}.tar.gz" | sha256sum -c \
&& tar xfz ${boost_dir}.tar.gz \
@@ -41,8 +43,23 @@ RUN wget http://downloads.sourceforge.net/project/boost/boost/${boost_version}/$
&& ./b2 -j 4 stage $boost_libs \
&& ./b2 -j 4 install $boost_libs \
&& cd .. && rm -rf ${boost_dir} && ldconfig
# install latest version of cmake
RUN wget \
https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz \
https://cmake.org/files/v3.7/cmake-3.7.2-SHA-256.txt \
https://cmake.org/files/v3.7/cmake-3.7.2-SHA-256.txt.asc \
&& gpg --keyserver pgp.mit.edu --recv 7BFB4EDA \
&& gpg --verbose --verify cmake-3.7.2-SHA-256.txt.asc cmake-3.7.2-SHA-256.txt \
&& grep cmake-3.7.2.tar.gz cmake-3.7.2-SHA-256.txt | sha256sum --check \
&& tar xzvf cmake-3.7.2.tar.gz \
&& cd cmake-3.7.2/ \
&& ./bootstrap \
&& make -j4 \
&& make install \
&& cd ../
# install nicehash
RUN git clone https://github.com/nicehash/nheqminer.git \
&& chmod +x nheqminer/cpu_xenoncat/asm_linux/* \
&& cd nheqminer/cpu_xenoncat/asm_linux \
@@ -50,13 +67,16 @@ RUN git clone https://github.com/nicehash/nheqminer.git \
&& cd /tmp \
&& mkdir build/ \
&& cd build/ \
&& cmake -DUSE_CUDA_DJEZO=OFF ../nheqminer \
&& cmake ../nheqminer \
&& make -j $(nproc) \
&& cp ./nheqminer /usr/local/bin/nheqminer
&& cp ./nheqminer /usr/local/bin/nheqminer \
&& chmod +x /usr/local/bin/nheqminer
RUN rm -rf /tmp/*
RUN useradd -ms /bin/bash nheqminer
USER nheqminer
WORKDIR /home/nheqminer
ENTRYPOINT ["bash"]
WORKDIR /home/nheqminer
ENTRYPOINT ["/usr/local/bin/nheqminer"]
CMD ["-h"]

81
Makefile Normal file
View File

@@ -0,0 +1,81 @@
help:
@cat Makefile
THREADS=
GPU?=0
HOST=$(shell hostname)
RESTART?=always
UID:=$(shell bash -c 'echo $$RANDOM')
LOCATION?=zec-us1.dwarfpool.com
PORT?=3335
ADDRESS?=t1QLFf7cemqpxPxFHL5tmtncbzUe7W7AqX8
DOCKER_FILE=Dockerfile
DOCKER?=nvidia-docker
TAG=nheqminer
NAME?=${HOST}_${UID}
define colorecho
@tput setaf $2
@echo $1
@tput sgr0
endef
ifneq ($THREADS,)
$THREADS:="-t ${THREADS}"
endif
NHEQ_FLAGS?=-l ${LOCATION}:${PORT} -u ${ADDRESS}.${NAME} -cd ${GPU} ${THREADS}
DOCKER_FLAGS=--restart ${RESTART} -i -d -h nheqminer --name ${NAME} unsalted/nheqminer
FLAGS?=$(NHEQ_FLAGS)
bash:
$(DOCKER) run -it -h nheqminer unsalted/$(TAG) bash
run:
$(DOCKER) run $(DOCKER_FLAGS) nheqminer $(NHEQ_FLAGS)
$(call colorecho,"\n\
Pool: ${LOCATION}\n\
Port: ${PORT}\n\
Address: ${ADDRESS}\n\
User: ${NAME}\n\
",6)
$(call colorecho, "Showing logs... exit with ctrl+c",7)
$(call colorecho, "Kill and delete machine with \`docker kill ${NAME} && docker rm ${NAME}\`\n",3)
docker logs -f ${NAME}
cpu:
DOCKER_FLAGS=--restart ${RESTART} -i -d -h nheqminer --name ${NAME} unsalted/nheqminer:cpu
docker run $(DOCKER_FLAGS) nheqminer $(NHEQ_FLAGS)
$(call colorecho,"\n\
Pool: ${LOCATION}\n\
Port: ${PORT}\n\
Address: ${ADDRESS}\n\
User: ${NAME}\n\
",6)
$(call colorecho, "Showing logs... exit with ctrl+c",7)
$(call colorecho, "Kill and delete machine with \`docker kill ${NAME} && docker rm ${NAME}\`\n",3)
docker logs -f ${NAME}
nheqminer:
$(DOCKER) run $(DOCKER_FLAGS) nheqminer ${FLAGS}
$(call colorecho,"\n\
Pool: ${LOCATION}\n\
Port: ${PORT}\n\
Address: ${ADDRESS}\n\
User: ${NAME}\n\
",6)
$(call colorecho, "Showing logs... exit with ctrl+c",7)
$(call colorecho, "Kill and delete machine with \`docker kill ${NAME} && docker rm ${NAME}\`\n",3)
docker logs -f ${NAME}
info:
$(DOCKER) run --rm -it -h nheqminer unsalted/$(TAG) nheqminer -ci

View File

@@ -16,7 +16,10 @@ For convenience there is also a *cpu only* build.
##### An example of installing nvidia-docker on Ubuntu 16.04
*It really isn't so bad...*
```
```bash
# requirement
sudo apt-get install nvidia-modprobe
# Install nvidia-docker and nvidia-docker-plugin
wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.0/nvidia-docker_1.0.0-1_amd64.deb
sudo dpkg -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb
@@ -31,27 +34,49 @@ nvidia-docker run --rm nvidia/cuda nvidia-smi
---
A few example commands to help get things up and running quickly.
**RUN**
`nvidia-docker run --rm -i -d -h nheqminer --name nheqminer unsalted/nheqminer`
**EXEC command (start, help, benchmark)**
`docker exec nheqminer bash -c "nheqminer -l zec-us1.dwarfpool.com:3335 -u YOUR_ZEC_ADDRESS.user -cd 0"`
**DOCKER RUN**
```bash
nvidia-docker run --restart always -i -d -h nheqminer unsalted/nheqminer \
nheqminer -l zec-us1.dwarfpool.com:3335 -u ZEC_ADDRESS.user -cd 0
```
**Enter the container**
**DOCKER Enter the container**
`docker exec -it nheqminer bash`
---
#### Nheqminer CPU *only*
---
**RUN**
`docker run --rm -i -d -h nheqminer --name nheqminer unsalted/nheqminer`
**Makefile**
**EXEC command (start, help, benchmark)**
`docker exec nheqminer bash -c "nheqminer -l zec-us1.dwarfpool.com:3334 -u YOUR_ZEC_ADDRESS.user -t 4"`
A makefile is provided with quickstart commands the only *required* variable is you ADDRESS, it will still run but it will mine to my address (thank you).
**Enter the container**
`docker exec -it nheqminer bash`
*Run with flags*
`make nheqminer FLAGS="-l zec-us1.dwarfpool.com:3336 -u t1UoqVgJYfRuZZyaU93FncJzXdhKmx6Vpb5.botbot -cd 0 1"`
*Run with variables*
`make run GPU="0 1" ADDRESS=MY_ADDRESS PORT=3356`
*Run cpu*
`make cpu ADDRESS=MY_ADDRESS PORT=3354 THREADS=4`
**Full list of default variables**
```
GPU=0
THREADS=Null
HOST=HOSTNAME
RESTART=always
UID=RANDOM
LOCATION=zec-us1.dwarfpool.com
PORT=3335
ADDRESS=t1UoqVgJYfRuZZyaU93FncJzXdhKmx6Vpb5
DOCKER=nvidia-docker
```
**For more information about using nheqminer see [their repository](https://github.com/nicehash/nheqminer)**.