Skip to content

Commit

Permalink
chore: target specific GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-van-woerkens committed Oct 24, 2024
1 parent b130a95 commit a4a1548
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ovh.conf
.env
test.js
monitoring.sh
notes.md
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ services:
- driver: nvidia
count: 1
capabilities: [gpu]
device_ids: ['0']
volumes:
- "./.ollama-service-1:/root/.ollama"
networks:
Expand Down Expand Up @@ -58,6 +59,7 @@ services:
- driver: nvidia
count: 1
capabilities: [gpu]
device_ids: ['1']
volumes:
- "./.ollama-service-2:/root/.ollama"
networks:
Expand Down
37 changes: 37 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import http from "k6/http";
import { check } from "k6";

export const options = { vus: 4, iterations: 40 };

const url = `https://${__ENV.HOST_IP}.nip.io/api/generate`;

const prompts = [
"Explain how a car engine works",
"Write a short story about a magical forest",
"What are the main principles of machine learning?",
"Describe the process of photosynthesis",
"Write a recipe for chocolate cake",
"Explain the theory of relativity",
"What are the benefits of meditation?",
"How does the internet work?",
];

const params = {
headers: {
"Content-Type": "application/json",
Authorization: `Basic ${__ENV.HOST_CREDENTIALS}`
},
timeout: '300s',
};

export default function () {
const randomIndex = Math.floor(Math.random() * prompts.length);
const prompt = prompts[randomIndex];

const payload = JSON.stringify({ prompt, model: "llama3.1" });
const response = http.post(url, payload, params);

check(response, {
"status is 200": (r) => r.status === 200,
});
}

0 comments on commit a4a1548

Please sign in to comment.