@@ -6,88 +6,49 @@ Ollama is an open-source software tool that simplifies running large language mo
66- [ Ollama] ( https://ollama.com )
77- [ Ollama GitHub] ( https://github.com/ollama/ollama )
88
9-
109## Prerequisites
11-
1210Before starting, ensure you have [ access] ( https://nag-devops.github.io/speed-hpc/#requesting-access ) to the HPC (Speed) cluster.
1311
1412## Instructions
13+ * Clone Speed Github repository
14+ ``` shell
15+ git clone --depth=1 https://github.com/NAG-DevOps/speed-hpc.git
16+ ```
1517
16- This requires having 2 sessions open
17-
18- ### Session A - get a GPU node & start the server
19-
20- * SSH to speed and start an interactive session with salloc
21- ``` shell
22- ssh < ENCSusername> @speed.encs.concordia.ca
23- salloc --mem=50G --gpus=1
24- ```
18+ * Navigate to ollama directory in ` src/llm-examples`
2519
26- * Create a working directory and navigate to it
27- ``` shell
28- mkdir /speed-scratch/$USER /ollama
29- cd /speed-scratch/$USER /ollama
30- ```
20+ * Run ` start_ollama.sh`
21+ ` ` ` shell
22+ sbatch start_ollama.sh
23+ ` ` `
3124
32- * Download Ollama tarball and extract it (creates the ollama binary here)
33- ``` shell
34- curl -LO https://ollama.com/download/ollama-linux-amd64.tgz
35- tar -xzf ollama-linux-amd64.tgz
36- ```
25+ The script will:
26+ - Request required resources
27+ - Download Ollama tarball and extract it
28+ - Add Ollama to user' s path and setup environment variables
3729
38- * Add ollama to your PATH for this session
39- ``` shell
40- setenv PATH /speed-scratch/$USER /ollama/bin:$PATH
41- ```
30+ ```shell
31+ setenv PATH /speed-scratch/$USER/ollama/bin:$PATH
32+ ```
4233
43- * Set Ollama to store its model in ` /speed-scratch ` to aviod quota limits
44- ``` shell
45- setenv OLLAMA_MODELS /speed-scratch/$USER /ollama/models
46- mkdir -p $OLLAMA_MODELS
47- ```
34+ - Start Ollama server with `ollama serve`
35+ - Print the ssh command to connect to the server.
4836
49- * Start ollama server
50- ``` shell
51- ollama serve
52- ```
53-
54- * Leave this session open
55-
56- ### Session B - hop to the same node & run/test
57- * open a new terminal window and ssh to speed then to the node you have the server running on
58- ``` shell
59- ssh < ENCSusername> @speed.encs.concordia.ca
60- ssh speed-XX
61- cd /speed-scratch/$USER /ollama
62- ```
63-
64- * Sanity check
65- ``` shell
66- setenv PATH /speed-scratch/$USER /ollama/bin:$PATH
67- ollama -v
68- ```
69-
70- * Pull a specific model and run it (Optional)
71- ``` shell
72- ollama pull llama3.1
73- echo " What is today" | ollama run llama3.1
74- ```
75-
76- * Create a Python environment to run the example
77- ``` shell
78- setenv ENV_DIR /speed-scratch/$USER /envs/python-env
79- mkdir -p $ENV_DIR /{tmp,pkgs,cache}
37+ Note: The server is set to run for 3 hours (adjust if needed)
8038
81- setenv TMP $ENV_DIR /tmp
82- setenv TMPDIR $ENV_DIR /tmp
83- setenv PIP_CACHE_DIR $ENV_DIR /cache
39+ * Open a new terminal window and paste the ssh command to connect to the speed node the server is running on. The command will look like:
40+ ```shell
41+ ssh -L XXXXX:localhost:XXXXX <ENCSusername>@speed.encs.concordia.ca -t ssh speed-XX
42+ ```
8443
85- python3 -m venv $ENV_DIR
86- source $ENV_DIR /bin/activate.csh
87- pip install -U pip ollama
88- ```
44+ * Navigate to ollama directory and do a sanity check
45+ ```shell
46+ setenv PATH /speed-scratch/$USER/ollama/bin:$PATH
47+ ollama -v
48+ ```
8949
90- * Copy the python file and execute it
50+ * Pull a specific model and run it interactively (optional).
9151```shell
92- python ollama_test.py
52+ ollama pull llama3.2
53+ echo "What is today" | ollama run llama3.2
9354```
0 commit comments