How to Set Up an M1 Mac Cluster Using Thunderbolt for Running DeepSeek

How to Set Up an M1 Mac Cluster Using Thunderbolt for Running DeepSeek
M1 Mac, Thunderbolt, Cluster, DeepSeek, MPI, IP-over-Thunderbolt, OpenMPI, Ray, Distributed Learning, Unified Memory

1. Concept of an M1 Mac Cluster with Thunderbolt

Although M1 Macs do not offer native clustering functionality like traditional x86 servers, they can leverage Thunderbolt 3/4 ports for high-speed networking. This allows distributed learning using MPI (Multi-Processing Interface).

Cluster Networking Options with Thunderbolt:

• Thunderbolt-to-Ethernet Bridge: Use Thunderbolt cables to connect multiple M1 Macs. In macOS network settings, configure an Ethernet Bridge to create a single network.

• IP-over-Thunderbolt: macOS supports Thunderbolt Bridge, enabling high-speed network connections that function like a typical TCP/IP network.

2. Cluster Setup Process

(1) Hardware Preparation

• Multiple M1 Macs (minimum of 2)

• Thunderbolt 3/4 cables (enough to connect all devices)

• A network router or a main Mac acting as the central bridge

(2) Configuring the Thunderbolt Network

1. Connect Macs Using Thunderbolt Cables:

• Use a daisy chain setup with one central Mac.

• Alternatively, connect all Macs to a single Thunderbolt Dock.

2. Enable IP-over-Thunderbolt:

• On each Mac, go to “System Settings” → “Network”.

• Add the “Thunderbolt Bridge” network interface.

• Assign a static IP to each Mac (e.g., 192.168.10.x range).

3. Test SSH Connections:

• Ensure all Macs can communicate via SSH.

• Use ssh-keygen to generate SSH keys and configure passwordless SSH access between nodes.

3. Software Setup for DeepSeek

To run the DeepSeek model, you need to configure the cluster for distributed learning.

(1) Python and PyTorch Installationbrew install python pip install torch torchvision torchaudio pip install torch --pre torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu # Optimized for M1

(2) Download and Run the DeepSeek Modelgit clone https://github.com/DeepSeek-AI/DeepSeek-LLM.git cd DeepSeek-LLM pip install -r requirements.txt

You will also need to download the model checkpoint from Hugging Face or another source.

(3) Configure MPI (Multi-Processing Interface)

M1 Mac clusters can use OpenMPI or Ray for distributed processing.

• Install OpenMPI:brew install open-mpi

• Example MPI Execution:mpirun -np 4 --hostfile hosts.txt python train.py

• Using Ray for Distributed Learning:

• On the head node:pip install ray ray start --head

• On each worker node:ray start --address=192.168.10.1:6379

4. Optimization and Management

1. Load Balancing: Use mpirun to control process distribution across nodes.

2. Memory Management: M1 Macs have unified memory; efficient management is crucial for training large models.

3. Use Docker: Leverage Apple Silicon-compatible Docker containers for easier deployment.docker pull deepseek/llm

5. Conclusion

Using Thunderbolt-based networking, you can create a high-speed M1 Mac cluster for distributed learning. This setup enables efficient data transfer, making it possible to train models like DeepSeek. However, due to the lack of GPU acceleration, you’ll need to focus on CPU-based optimization and use tools like OpenMPI or Ray to manage distributed workloads effectively.

Test this configuration and let me know if you encounter any issues! 🚀

Read more

ollama Cloud oss120B급  병렬 분석 효율 분석: 1개 vs 8개 워커 비교

ollama Cloud oss120B급 병렬 분석 효율 분석: 1개 vs 8개 워커 비교

대규모 학술 논문 아카이브 KOINEU.com의 V3 파이프라인 구축 과정에서 얻은 데이터 분석 속도 최적화 사례를 공유합니다. 25만 건의 방대한 논문을 분석하기 위해 Ollama Cloud의 oss120b 모델을 어떻게 효율적으로 활용했는지에 대한 기술 리포트입니다.. 1. 실험 개요 초거대 모델(120B)은 압도적인 분석 능력을 자랑하지만, 단일 요청 시 처리 시간이 길다는

By ilikeafrica
다이소 겨자잎, 루꼴라 씨앗 발아 3일차

다이소 겨자잎, 루꼴라 씨앗 발아 3일차

역시 씨앗은 한번 발아하면 참 놀랍도록 빠르다. 타임랩스를 찍어보고 싶었는데 이젠 그럴 만한 디바이스가 없다. 모조리 당근행 해버린 관계로 집에 남아있는게 별로 없다. ㅋㅋ 언제 떠날지 또 미지수인 관계로 그 날까지는 뭔가 즐길거리를 찾아야 한다. 겨자잎에 삼겹살 한번이라도 싸먹고 나가게 될까... 겨자잎 안먹어도 좋으니 언능 정리되고 배낭 싸고 싶다..

By ilikeafrica
도시 농부 겨자잎, 루꼴라 키우기

도시 농부 겨자잎, 루꼴라 키우기

오피스텔 책상 한켠에 마련해둔 겨자잎 과 루꼴라 공장.. 알리에서 구매했던 인공조명LED를 그냥 두기도 아깝고 겸사 겸사 생수통 3개에 다이소에서 천원씩에 구매한 겨자잎과 루꼴라 씨를 뿌리고 만들어봤다. 배양토에 파종한지 2일만에 싹이 돋아난다. 부랴 부랴 재활용품 모아둔곳에서 적당한 박스 하나 사서 LED 조명을 대충 붙이고, 전원은 사용하지 않고 있던 휴대용 배터리로 간편하게

By ilikeafrica