Skip to content

[ERP-2645] Add 'resources' config item #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions src/components/tool/guide/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const DEFAULT_CONFIG = {
ram: 32,
gpuModules: 1,
wallTime: { hours: 1, minutes: 0 },
resources: "Automatic",
jobType: "Batch",
jobInstanceType: "Standalone",
arrayConfig: { firstIndex: 1, upperBound: 10, step: 1 },
};
Expand All @@ -24,6 +26,7 @@ export const isValidChoice = (choices, value) => {
};

export const isLyra = (config) => config?.service === "Lyra";
export const isCustom = (config) => config?.resources === "Custom";
export const isWorkstation = (config) =>
["rVDI", "Local"].includes(config?.service);
export const isGPU = (config) => config?.hardware === "GPU";
Expand Down Expand Up @@ -71,7 +74,7 @@ export const getCpuVendor = (config, onChange) => () => {
}}
/>
),
show: (config) => isLyra(config),
show: (config) => isLyra(config) && isCustom(config),
selected: (config) => isValidChoice(cpuVendors, config?.cpuVendor),
};
};
Expand All @@ -86,9 +89,23 @@ export const getCpuModel = (config, onChange) => () => {

let alertMsg;
if (config?.cpuModel === "E7-8890v4") {
alertMsg = "The E7-8890v4 CPU should only be used for large memory jobs.";
alertMsg =
"The E7-8890v4 CPU should only be used for jobs with more than 512 GB of ram.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought: replacing with by require sounds more appropriate? Also should ram be capitals? It's abbreviation sames as CPU.

} else if (config?.cpuModel === "8260") {
alertMsg = "The 8260 CPU is reserved for the microbiome group.";
} else if (config?.cpuModel === "6248") {
alertMsg = (
<TextWithLink
textBeforeLink={"6248 CPUs are currently unavailable. Please "}
link={{
href: "https://eresearchqut.atlassian.net/servicedesk/customer/portals",
text: "contact eResearch",
isExternal: true,
}}
hasExternalIcon={true}
textAfterLink={" if interested."}
/>
);
}

return {
Expand All @@ -108,7 +125,10 @@ export const getCpuModel = (config, onChange) => () => {
/>
),
show: (config) =>
isLyra(config) && config?.cpuVendor && config.cpuVendor !== "Any",
isLyra(config) &&
isCustom(config) &&
config?.cpuVendor &&
config.cpuVendor !== "Any",
selected: (config) => isValidChoice(cpuModels, config?.cpuModel),
};
};
Expand Down Expand Up @@ -266,7 +286,7 @@ export const getGpuVendor = (config, onChange) => () => {
/>
);
},
show: (config) => isLyra(config) && isGPU(config),
show: (config) => isLyra(config) && isCustom(config) && isGPU(config),
selected: (config) => isValidChoice(gpuVendors, config?.gpuVendor),
};
};
Expand Down Expand Up @@ -300,6 +320,7 @@ export const getGpuModel = (config, onChange) => () => {
),
show: (config) =>
isLyra(config) &&
isCustom(config) &&
config?.hardware === "GPU" &&
config?.gpuVendor &&
config.gpuVendor !== "Any",
Expand Down Expand Up @@ -329,7 +350,7 @@ export const getGpuModules = (config, onChange) => () => {
}
/>
),
show: (config) => isLyra(config) && isGPU(config),
show: (config) => isLyra(config) && isCustom(config) && isGPU(config),
selected: () => true,
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function EresearchInstructions({ config }) {
<LyraStartInstructions
jobType={config.jobType}
jobName={batchJobName}
resources={config.resources}
hardware={config.hardware}
cpuVendor={config.cpuVendor}
cpuModel={config.cpuModel}
Expand Down
37 changes: 35 additions & 2 deletions src/components/tool/guide/EresearchJob/EresearchJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,34 @@ const getConfigGroups = (config, onConfigChange = () => {}) => {
selected: (config) => isValidChoice(jobTypes, config?.jobType),
};
},
resources: () => {
return {
element: (key, selected) => (
<ConfigPicker
key={key}
title="Resources"
description="The resources available on the nodes used by the job."
selected={selected}
inputProps={{
choices: [
["Automatic", "Run the job without specifying resources"],
["Custom", "Specify the resources to use for the job"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought: Is to use necessary? I think Specify the resources for the job (manually) would be sufficient?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarified the wording

],
value: config?.resources,
onChange: onChange("resources"),
}}
showAlert={config?.resources === "Custom"}
alertType="warning"
alertMsg={
"Jobs with custom resources may not run, and are not recommended for general use."
}
/>
),
show: (config) => config?.service === "Lyra",
selected: (config) =>
isValidChoice(["Automatic", "Custom"], config?.resources),
};
},
nodes: () => {
return {
element: (key, selected) => (
Expand Down Expand Up @@ -133,7 +161,9 @@ const getConfigGroups = (config, onConfigChange = () => {}) => {
/>
),
show: (config) =>
config?.service === "Lyra" && config?.jobType === "Batch",
config?.service === "Lyra" &&
config?.resources === "Custom" &&
config?.jobType === "Batch",
selected: (config) => config?.nodes > 0,
};
},
Expand Down Expand Up @@ -268,7 +298,10 @@ const getConfigGroups = (config, onConfigChange = () => {}) => {
}
/>
),
show: (config) => config?.service,
show: (config) =>
config?.service === "Lyra"
? config?.resources === "Custom"
: config?.service,
selected: (config) => isValidChoice(["CPU", "GPU"], config?.hardware),
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const LyraBatch = {
...DEFAULT_CONFIG,
service: "Lyra",
jobType: "Batch",
resources: "Automatic",
hardware: "CPU",
cpuVendor: "Any",
cpus: 4,
Expand All @@ -36,6 +37,7 @@ export const LyraInteractive = {
...DEFAULT_CONFIG,
service: "Lyra",
jobType: "Interactive",
resources: "Automatic",
hardware: "CPU",
cpuVendor: "Any",
cpus: 4,
Expand All @@ -50,6 +52,7 @@ export const LyraCustomHardware = {
...DEFAULT_CONFIG,
service: "Lyra",
jobType: "Batch",
resources: "Custom",
hardware: "GPU",
cpuVendor: "Intel",
cpuModel: "6248",
Expand All @@ -68,6 +71,7 @@ export const LyraMultiNode = {
...DEFAULT_CONFIG,
service: "Lyra",
jobType: "Batch",
resources: "Automatic",
hardware: "CPU",
cpuVendor: "Any",
cpus: 4,
Expand All @@ -83,6 +87,7 @@ export const LyraArray = {
...DEFAULT_CONFIG,
service: "Lyra",
jobType: "Batch",
resources: "Automatic",
jobInstanceType: "Array",
arrayConfig: { firstIndex: 0, upperBound: 1000, step: 100 },
hardware: "CPU",
Expand Down
56 changes: 44 additions & 12 deletions src/components/tool/guide/Instructions/StartInstructions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import InstructionText from "./components/InstructionText";
export function LyraStartInstructions({
jobType,
jobName = "",
resources,
nodes,
wallTime,
hardware,
Expand All @@ -24,19 +25,25 @@ export function LyraStartInstructions({
jobInstanceType,
arrayConfig,
}) {
const resources = [
const resourceValues = [
`select=${jobType === "Interactive" ? 1 : nodes}`,
`ncpus=${cpus}`,
`mem=${ram}gb`,
];
if (cpuVendor !== "Any") {
if (cpuModel !== "Any") resources.push(`cputype=${cpuModel}`);
else resources.push(cpuVendor === "AMD" ? "cpuarch=amd" : "cpuarch=avx512");
}
if (hardware === "GPU") {
resources.push(`ngpus=${gpuModules}`);
if (gpuVendor !== "Any" && gpuModel) {
resources.push(`gputype=${gpuModel}`);

if (resources === "Custom") {
if (cpuVendor !== "Any") {
if (cpuModel !== "Any") resourceValues.push(`cputype=${cpuModel}`);
else
resourceValues.push(
cpuVendor === "AMD" ? "cpuarch=amd" : "cpuarch=avx512",
);
}
if (hardware === "GPU") {
resourceValues.push(`ngpus=${gpuModules}`);
if (gpuVendor !== "Any" && gpuModel) {
resourceValues.push(`gputype=${gpuModel}`);
}
}
}

Expand All @@ -59,7 +66,7 @@ export function LyraStartInstructions({
"#!/bin/bash -l",
`#PBS -N ${jobName}`,
`#PBS -l walltime=${wallTimeStr}`,
`#PBS -l ${resources.join(":")}`,
`#PBS -l ${resourceValues.join(":")}`,
...(jobInstanceType === "Array"
? [
`#PBS -J ${arrayConfig?.firstIndex}-${arrayConfig?.upperBound}${arrayConfig?.step > 1 ? `:${arrayConfig?.step}` : ""}`,
Expand All @@ -76,7 +83,7 @@ export function LyraStartInstructions({

const cmdText =
jobType === "Interactive"
? `qsub${jobParameters.join("")} -l walltime=${wallTimeStr} -l ${resources.join(":")}`
? `qsub${jobParameters.join("")} -l walltime=${wallTimeStr} -l ${resourceValues.join(":")}`
: `qsub ${scriptPath || `${jobName}.pbs`}`;

return (
Expand Down Expand Up @@ -115,12 +122,37 @@ export function LyraStartInstructions({
/>
</>
)}
{resources === "Custom" && (
<>
<InstructionHeading>Custom resources</InstructionHeading>
<InstructionText>
Before running the job, double-check that the resources requested
are available on a node by running the following command:
</InstructionText>
<CommandBox
command={`pbsnodeinfo`}
output={`Node : cputype | cpuarch ; cpu usage; mem usage; gputype; gpu usage
=====================================================================================
cl4n001 : E7-8890v4 | avx,avx2 ; 110 / 192 cpus; 5599 / 5791 GB
cl4n002 : 6140 |avx,avx2,avx512 ; 11 / 36 cpus; 178 / 183 GB; P100; 3 / 4 gpus
cl4n003 : 6140 |avx,avx2,avx512 ; 10 / 36 cpus; 167 / 183 GB; P100; 3 / 4 gpus
cl4n007 : 6140 |avx,avx2,avx512 ; 31 / 36 cpus; 352 / 373 GB
cl4n008 : 6140 |avx,avx2,avx512 ; 25 / 36 cpus; 320 / 373 GB
cl4n009 : 6140 |avx,avx2,avx512 ; 35 / 36 cpus; 360 / 373 GB
cl4n010 : 6140 |avx,avx2,avx512 ; 35 / 36 cpus; 266 / 373 GB
...`}
/>
</>
)}

<InstructionHeading>Schedule a job</InstructionHeading>
<InstructionText>
Run the following command to schedule the {jobType.toLowerCase()} job:
</InstructionText>
<CommandBox command={cmdText} output="{jobId}.pbs" />
<CommandBox
command={cmdText}
output={`{jobId}${jobInstanceType === "Array" ? "[]" : ""}.pbs`}
/>
</>
);
}
Expand Down
Loading