diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..be233de --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +nimenv_localminers/ +my_model/ +.DS_Store +.env \ No newline at end of file diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..dc21ab1 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +ADDR= \ No newline at end of file diff --git a/.gitignore b/.gitignore index dc68394..be233de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ nimenv_localminers/ my_model/ -.DS_Store \ No newline at end of file +.DS_Store +.env \ No newline at end of file diff --git a/README.md b/README.md index bdc24da..0a1f3ef 100644 --- a/README.md +++ b/README.md @@ -1 +1,52 @@ -# nimble-miner-public \ No newline at end of file +# nimble-miner-public + +## How to use nimble miner with docker + +### 1. Install docker and nvidia-docker +[install-guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) +#### Installing with Apt +1. Configure the production repository: +``` +$ curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ + && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ + sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ + sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list +``` + +2. Optionally, configure the repository to use experimental packages: + +``` +$ sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list +``` + +3. Update the packages list from the repository: + +``` +$ sudo apt-get update +``` + +4. Install the NVIDIA Container Toolkit packages: +``` +$ sudo apt-get install -y nvidia-container-toolkit +``` +### 2. Config ENV +copy .env.example to .env and edit it +``` +cp .env.example .env +``` + +env example +``` +ADDR=nimblexxxx +``` +### 3. Start +#### via docker-compose +``` +docker-compose up -d + +docker logs -f nimble-miner-public-miner-1 +``` +#### via docker +``` +docker build -t nimble-miner-public:latest . +docker run -d --gpus all --name nimble-miner-public-miner-1 nimble-miner-public:latest "python3 -u /app/execute.py ${YOUR_ADDR}" \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..b36caf3 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,21 @@ +version: "3.8" +services: + miner: + build: . + volumes: + - ./my_module:/app/my_module + - ./nimenv_localminers:/app/nimenv_localminers + command: "python3 -u /app/execute.py ${ADDR}" + env_file: + - .env + ulimits: + memlock: -1 + stack: 67108864 + # https://docs.docker.com/compose/gpu-support/ + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 # number of GPUs + capabilities: [gpu] \ No newline at end of file diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..8483dd8 --- /dev/null +++ b/dockerfile @@ -0,0 +1,5 @@ +FROM nvcr.io/nvidia/pytorch:23.07-py3 +WORKDIR /app +COPY requirements-docker.txt /app +RUN pip install -r requirements-docker.txt +COPY . /app \ No newline at end of file diff --git a/requirements-docker.txt b/requirements-docker.txt new file mode 100644 index 0000000..dfbdfb7 --- /dev/null +++ b/requirements-docker.txt @@ -0,0 +1,6 @@ +requests==2.31.0 +accelerate==0.27.0 +transformers==4.38.1 +datasets==2.17.1 +numpy==1.26.4 +gitpython==3.1.42