Skip to content

Instantly share code, notes, and snippets.

View Delaunay's full-sized avatar

Setepenre Delaunay

  • Montréal
View GitHub Profile
SHR_ON = 1
def _worker(in_queue, out_queue, shared_state, cls, cls_args):
shared_state[SHR_ON] = 1
with cls(*cls_args, out_queue=out_queue) as handler:
while shared_state[SHR_ON]:
try:
args, kwargs = in_queue.get(True, timeout=0.01)
handler(args, kwargs)
import multiprocessing
from multiprocessing.managers import SharedMemoryManager
import time
import json
SHM_INDEX_IN = -1
SHM_INDEX_OUT = -2
SHM_ON = -3
SHM_SIZE = -4
SHM_MAX = 4
@Delaunay
Delaunay / PAICE.yaml
Created February 26, 2024 17:02
PAICE.yaml
_defaults:
max_duration: 600
voir:
options:
stop: 60
interval: "1s"
_torchvision:
inherits: _defaults
definition: ../benchmarks/torchvision
_defaults:
max_duration: 600
voir:
options:
stop: 60
interval: "1s"
_torchvision:
inherits: _defaults
definition: ../benchmarks/torchvision
@Delaunay
Delaunay / client.py
Last active October 2, 2023 17:45
Run a LLAMA2 inference server on slurm
import json
import subprocess
import random
import openai
def get_slurm_job_by_name(name):
command = ["squeue", "-h", f"--name={name}", "--format=\"%A %j %T %P %U %k %N\""]
output = subprocess.check_output(command, text=True)
@Delaunay
Delaunay / llama2.sh
Last active October 2, 2023 15:55
Run LLAMA2 on a Slurm cluster
#!/bin/bash
#
# Assume you have conda installed
# Clone the LLAMA code and create a new environment
#
# Usage:
#
# sbatch --ntasks-per-node=1 --mem=32G llama2.sh llama-2-7b-chat
# sbatch --ntasks-per-node=2 --mem=64G llama2.sh llama-2-13b-chat
@Delaunay
Delaunay / GKFogOfWarPawn.patch
Created April 22, 2023 15:04
GKFogOfWarPawn.patch
diff --git a/Source/GKFogOfWar/Public/GKFogOfWarPawn.h b/Source/GKFogOfWar/Public/GKFogOfWarPawn.h
index b7d940c..33eda34 100644
--- a/Source/GKFogOfWar/Public/GKFogOfWarPawn.h
+++ b/Source/GKFogOfWar/Public/GKFogOfWarPawn.h
@@ -8,13 +8,16 @@
// Unreal Engine
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
+#include "Net/UnrealNetwork.h"
@Delaunay
Delaunay / GKGameplayCueNotify_ActorExample.cpp
Created November 13, 2022 02:25
GKGameplayCueNotify_ActorExample
// BSD 3-Clause License Copyright (c) 2022, Pierre Delaunay All rights reserved.
#include "GKGameplayCueNotify_ActorExample.h"
void AGKGameplayCueNotify_ActorExample::ReuseAfterRecycle() {
AGameplayCueNotify_Actor::ReuseAfterRecycle();
OnReuseAfterRecycle();
}
@Delaunay
Delaunay / mongod.py
Created August 2, 2022 15:39
Run MongoDB inside python for integration testing
from dataclasses import dataclass
import tempfile
import os
import subprocess
import traceback
import logging
from contextlib import contextmanager
import time
from multiprocessing import Manager, Process
# I setup my docker runner to cache those directories
# So the environments are only updated when different
variables:
XDG_CACHE_HOME: "/cache/pip"
PIP_CACHE_DIR: "/cache/pip"
OLYMPUS_DATA_PATH: "/cache/data"
ENV_CACHE_DIR: "/cache/env"
stages:
- tests