mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 01:09:24 +08:00
modules.services.slurm: memoryMB -> memoryGB
This commit is contained in:
@@ -115,11 +115,11 @@ inputs:
|
||||
{
|
||||
name = "pc"; address = "127.0.0.1";
|
||||
cpu = { sockets = 2; cores = 8; threads = 2; };
|
||||
memoryMB = 80 * 1024;
|
||||
memoryGB = 80;
|
||||
gpus."4060" = 1;
|
||||
};
|
||||
partitions.localhost = [ "pc" ];
|
||||
tui = { cpuQueues = [{ mpiThreads = 4; openmpThreads = 4; memoryMB = 64 * 1024; }]; gpuIds = [ "4060" ]; };
|
||||
tui = { cpuQueues = [{ mpiThreads = 4; openmpThreads = 4; memoryGB = 64; }]; gpuIds = [ "4060" ]; };
|
||||
};
|
||||
ollama = {};
|
||||
docker = {};
|
||||
|
||||
@@ -33,25 +33,25 @@ inputs:
|
||||
{
|
||||
name = "n0"; address = "192.168.178.1";
|
||||
cpu = { sockets = 4; cores = 20; threads = 2; };
|
||||
memoryMB = 112 * 1024;
|
||||
memoryGB = 112;
|
||||
};
|
||||
srv1-node1 =
|
||||
{
|
||||
name = "n1"; address = "192.168.178.2";
|
||||
cpu = { sockets = 4; cores = 8; threads = 2; };
|
||||
memoryMB = 56 * 1024;
|
||||
memoryGB = 56;
|
||||
};
|
||||
srv1-node2 =
|
||||
{
|
||||
name = "n2"; address = "192.168.178.3";
|
||||
cpu = { sockets = 4; cores = 8; threads = 2; };
|
||||
memoryMB = 56 * 1024;
|
||||
memoryGB = 56;
|
||||
};
|
||||
srv1-node3 =
|
||||
{
|
||||
name = "n3"; address = "192.168.178.4";
|
||||
cpu = { sockets = 4; cores = 8; threads = 2; };
|
||||
memoryMB = 32 * 1024;
|
||||
memoryGB = 32;
|
||||
};
|
||||
};
|
||||
partitions =
|
||||
|
||||
@@ -44,14 +44,14 @@ inputs:
|
||||
{
|
||||
name = "n0"; address = "192.168.178.1";
|
||||
cpu = { sockets = 2; cores = 22; threads = 2; };
|
||||
memoryMB = 240 * 1024;
|
||||
memoryGB = 240;
|
||||
gpus."4090" = 1;
|
||||
};
|
||||
srv2-node1 =
|
||||
{
|
||||
name = "n1"; address = "192.168.178.2";
|
||||
cpu = { sockets = 2; cores = 8; threads = 2; };
|
||||
memoryMB = 80 * 1024;
|
||||
memoryGB = 80;
|
||||
gpus = { "3090" = 1; "4090" = 1; };
|
||||
};
|
||||
};
|
||||
@@ -66,8 +66,8 @@ inputs:
|
||||
{
|
||||
cpuQueues =
|
||||
[
|
||||
{ name = "n0"; mpiThreads = 8; openmpThreads = 5; memoryMB = 224 * 1024; }
|
||||
{ name = "n1"; mpiThreads = 3; openmpThreads = 4; memoryMB = 48 * 1024; }
|
||||
{ name = "n0"; mpiThreads = 8; openmpThreads = 5; memoryGB = 224; }
|
||||
{ name = "n1"; mpiThreads = 3; openmpThreads = 4; memoryGB = 48; }
|
||||
];
|
||||
gpuIds = [ "4090" "3090" ];
|
||||
gpuPartition = "all";
|
||||
|
||||
@@ -16,7 +16,7 @@ inputs:
|
||||
cores = mkOption { type = types.ints.unsigned; default = 1; };
|
||||
threads = mkOption { type = types.ints.unsigned; default = 1; };
|
||||
};
|
||||
memoryMB = mkOption { type = types.ints.unsigned; default = 1024; };
|
||||
memoryGB = mkOption { type = types.ints.unsigned; default = 1024; };
|
||||
gpus = mkOption { type = types.nullOr (types.attrsOf types.ints.unsigned); default = null; };
|
||||
};}));};
|
||||
partitions = mkOption { type = types.attrsOf (types.listOf types.nonEmptyStr); default = {}; };
|
||||
@@ -30,7 +30,7 @@ inputs:
|
||||
name = mkOption { type = types.nonEmptyStr; default = "localhost"; };
|
||||
mpiThreads = mkOption { type = types.ints.unsigned; default = 1; };
|
||||
openmpThreads = mkOption { type = types.ints.unsigned; default = 1; };
|
||||
memoryMB = mkOption { type = types.ints.unsigned; default = 0; };
|
||||
memoryGB = mkOption { type = types.ints.unsigned; default = 0; };
|
||||
};}));
|
||||
};
|
||||
gpuIds = mkOption { type = types.nullOr (types.listOf types.nonEmptyStr); default = null; };
|
||||
@@ -83,7 +83,7 @@ inputs:
|
||||
node.value.name
|
||||
"NodeHostname=${node.name}"
|
||||
"NodeAddr=${node.value.address}"
|
||||
"RealMemory=${builtins.toString node.value.memoryMB}"
|
||||
"RealMemory=${builtins.toString (node.value.memoryGB * 1024)}"
|
||||
"Sockets=${builtins.toString node.value.cpu.sockets}"
|
||||
"CoresPerSocket=${builtins.toString node.value.cpu.cores}"
|
||||
"ThreadsPerCore=${builtins.toString node.value.cpu.threads}"
|
||||
@@ -265,7 +265,7 @@ inputs:
|
||||
(queue:
|
||||
[
|
||||
queue.name
|
||||
{ CpuMpiThreads = queue.mpiThreads; CpuOpenmpThreads = queue.openmpThreads; MemoryMB = queue.memoryMB; }
|
||||
{ CpuMpiThreads = queue.mpiThreads; CpuOpenmpThreads = queue.openmpThreads; MemoryGB = queue.memoryGB; }
|
||||
])
|
||||
slurm.tui.cpuQueues;
|
||||
};
|
||||
|
||||
@@ -11,8 +11,8 @@ int main()
|
||||
|
||||
struct Device
|
||||
{
|
||||
// Queue : { CpuMpiThreads, CpuOpenmpThreads, MemoryMB }
|
||||
struct CpuQueueType { int CpuMpiThreads, CpuOpenmpThreads, MemoryMB; };
|
||||
// Queue : { CpuMpiThreads, CpuOpenmpThreads, MemoryGB }
|
||||
struct CpuQueueType { int CpuMpiThreads, CpuOpenmpThreads, MemoryGB; };
|
||||
std::vector<std::pair<std::string, CpuQueueType>> CpuQueues;
|
||||
std::optional<std::vector<std::string>> GpuIds;
|
||||
std::string GpuPartition;
|
||||
@@ -235,13 +235,13 @@ int main()
|
||||
state.job_name, state.output_file, state.vasp_entries[state.vasp_selected]
|
||||
);
|
||||
else state.submit_command =
|
||||
"sbatch --partition={} --nodes=1-1\n--ntasks={} --cpus-per-task={} --mem={}M\n--job-name='{}' --output='{}'\n"
|
||||
"sbatch --partition={} --nodes=1-1\n--ntasks={} --cpus-per-task={} --mem={}G\n--job-name='{}' --output='{}'\n"
|
||||
"--wrap=\"vasp-intel srun vasp-{}\""_f
|
||||
(
|
||||
state.queue_entries[state.queue_selected],
|
||||
state.mpi_threads, state.openmp_threads, state.job_name, state.output_file,
|
||||
ranges::find_if(device.CpuQueues,
|
||||
[&](auto &x){ return x.first == state.queue_entries[state.queue_selected]; })->second.MemoryMB,
|
||||
[&](auto &x){ return x.first == state.queue_entries[state.queue_selected]; })->second.MemoryGB,
|
||||
state.vasp_entries[state.vasp_selected]
|
||||
);
|
||||
state.user_command.clear();
|
||||
|
||||
Reference in New Issue
Block a user