*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit ad1ff5ef authored by Pfister, Martin's avatar Pfister, Martin
Browse files

Remove CPU affinity again (no time difference for DDP)

parent 1dcdc510
No related branches found
No related tags found
No related merge requests found
# https://saankhya.medium.com/mistral-instruct-7b-finetuning-on-medmcqa-dataset-6ec2532b1ff1
import psutil
import torch
from accelerate import PartialState
from datasets import load_dataset
......@@ -12,26 +11,6 @@ import medmcqa_helper
import gpu_helper
def lumi_set_cpu_affinity(local_rank):
LUMI_GPU_CPU_map = {
# A mapping from GCD to the closest CPU cores in a LUMI-G node
# Note that CPU cores 0, 8, 16, 24, 32, 40, 48, 56 are reserved for the
# system and not available for the user
# See https://docs.lumi-supercomputer.eu/hardware/lumig/
0: [49, 50, 51, 52, 53, 54, 55],
1: [57, 58, 59, 60, 61, 62, 63],
2: [17, 18, 19, 20, 21, 22, 23],
3: [25, 26, 27, 28, 29, 30, 31],
4: [1, 2, 3, 4, 5, 6, 7],
5: [9, 10, 11, 12, 13, 14, 15],
6: [33, 34, 35, 36, 37, 38, 39],
7: [41, 42, 43, 44, 45, 46, 47],
}
cpu_list = LUMI_GPU_CPU_map[local_rank]
print(f"Local rank {local_rank} binding to cpus: {cpu_list}")
psutil.Process().cpu_affinity(cpu_list)
model_id = 'mistralai/Mistral-7B-Instruct-v0.3'
tokenizer = AutoTokenizer.from_pretrained(model_id)
......@@ -54,8 +33,6 @@ num_processes = ps.num_processes
process_index = ps.process_index
local_process_index = ps.local_process_index
lumi_set_cpu_affinity(local_process_index)
model = AutoModelForCausalLM.from_pretrained(
model_id,
quantization_config=quantization_config,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment