Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement distributed training using Kubernetes #77

Merged
merged 17 commits into from
Jan 23, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add initial Dockerfile and k8s deployment
  • Loading branch information
leogao2 committed Jan 23, 2021
commit 1bdb8141517ebd6f207588c266326200ce2c7455
15 changes: 15 additions & 0 deletions kubernetes/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM atlanticcrypto/cuda-ssh-server:10.2-cudnn

RUN echo 'AuthorizedKeysFile .ssh/authorized_keys' >> /etc/ssh/sshd_config && \
apt-get update && \
apt-get install -y git python3.8 python3.8-dev python3-pip sudo && \
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1

RUN mkdir -p ~/.ssh && \
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQChClBdh2UXpMhBV725nH1bMsGVaLmYAp8uMZFHtBqHN56sj/35jeenQTqr/Tov3u6xwqJK+rxegjgcPDZfuOSdsNnTMCLIacA/WqBMwW1mjdMc+zFOub7vQJHj4nmeF3pd4tSjt720ZLiX1ZsF5QrTIcnURAXT0/82SKIy2nqj18v9HCcIvBplexJU3SlVg+oWk/e5CsfnXvJMQH3VqJaeyrXIlaFgVOvVWSBY66Kc2H+g1RxLwe+BONyNanxSXxKHQwUXawBvXIyjekapB3HiNWLZZfZjNmqe2Ci+Y9PKn0CrkgXopIP7tVKn+UQ2fD3nSjaZyfRrmcFgXdotFKJh root@sshd-sid-79b6f9d7c6-mmw8x' > ~/.ssh/authorized_keys

RUN python3 -m pip install --upgrade pip && \
pip3 install torch pipx && \
python3 -m pipx ensurepath
51 changes: 51 additions & 0 deletions kubernetes/deploy_k8s.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: eleuther-neox
spec:
strategy:
type: Recreate
replicas: 2
selector:
matchLabels:
app.kubernetes.io/name: eleuther-neox
template:
metadata:
labels:
app.kubernetes.io/name: eleuther-neox
spec:
terminationGracePeriodSeconds: 10
containers:
- name: neox
command: ["/usr/sbin/sshd"]
args: ["-D"]
tty: true
image: leogao2/deepspeed_eleuther
ports:
- name: sshd
containerPort: 2222
Copy link

@amannm amannm Jan 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be 22 as suggested by the EXPOSE at https://github.com/coreweave/cuda-ssh-server/blob/master/Dockerfile#L37 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I had thought as well, but Leo and I tested it and it seems to work with 2222. Not sure why / what difference it makes though.

protocol: TCP

resources:
requests:
cpu: 30
memory: 40Gi
limits:
nvidia.com/gpu: 8

affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
# Edit for different GPU
- key: gpu.nvidia.com/model
operator: In
values:
- GeForce_RTX_2080_Ti
- key: failure-domain.beta.kubernetes.io/region
operator: In
values:
- ORD1

restartPolicy: Always