(v2.2.0.1) Integrating with Slurm Cluster
The following manual steps for EAR will be replaced with a simplified workflow for command line users and alternatively, the Mangement Console (Web UI) will be able to replace most of these steps, as well.
Connect to Your Slurm Head Node
During Early Access, integreation requires a handful of commands and root or sudo access on the slurm controller, where slurmctld
runs.
Get a shell on the head node and navigate to the slurm configuration directory, where
slurm.conf
resides.[ root@HEAD ~ ]# cd $SLURM_CONF_DIR
Make a subdirectories here:
[ root@HEAD /etc/slurm ]# mkdir -p assets/json [ root@head /etc/slurm ]# cd assets/json [ root@head /etc/slurm/assets/json ]#
Pull Down the Default Slurm Environment Assets as a JSON Payload:
We will need the private MGMT_SERVER_IP, and the packages for
jq
andcurl
:yum install jq curl
Pull down from the MGMT_SERVER default assets for customization:
The asset will look like:
Edit the Slurm Environment JSON for Your Purposes:
Copy
default-slurm-env.json
to something convenient likeenv0.json
.Lines 5-17 can be modified for a single pool of identical compute resources or they can be duplicated and then modified for each “hardware” configuration or “pool” you choose. When duplicating, be sure to add a comma after the brace on line 17, except when it is the last brace, or the final pool declaration.
PoolName
: This will be the apparent hostnames of the compute resources provided for slurm.It is recommended that all pools share a common trunk or base in each
PoolName
.
PoolSize
: This is the maximum number of these compute resources.ProfileName
: This is the default profile name,az1
: If this is changed, you will need to carry the change forward.CPUs
: This is the targeted CPU-core limit for this "hardware" configuration or pool.ImageName
: This is tied to the AMI that will be used for your compute resources. This name will be used in subsequent steps.MaxMemory
: This is the targeted memory limit for this "hardware" configuration or pool.MinMemory
: reserved for future use; can be ignored currently.UserData
: This string is a base64 encoded version of user_data.To generate it:
cat user_data.sh | base64 -w 0
To decode it:
echo "<LongBase64EncodedString>" | base64 -d
It’s not required to be perfectly fine-tuned at this stage; it will be refined and corrected later.
VolumeSize: reserved for future use; can be ignored currently.
Lines 24, 25, 26 should be modified for your slurm environment and according to your preference for the partition name.
BinPath
: This is wherescontrol
,squeue
, and other slurm binaries exist.ConfPath
: This is whereslurm.conf
resides.PartitionName
: This is for naming the new partition.
All other fields/lines in this asset can be ignored.
Validate and Push the Customized Environment to the MGMT_SERVER
Validate the JSON asset with
jq
:You will see well-formatted JSON if
jq
can read the file, indicating no errors. If you see an error message, that means the JSON is not valid.
When the JSON is valid, the file can be pushed to the MGMT_SERVER:
Pull Down the Default Profile Assets as a JSON Payload:
get it
back it up
The asset will look like this:
Edit the Profile JSON for Your Purposes:
Lines 5-9, 25-29 : tagging
Controllers
Workers
JSON reminder
Line 11:
InstanceType
Controllers, always ondemand
Line 20:
MaxControllers
x80
Line 21:
ProfileName
Lines 31-34 on-demand-worker explanation
Lines 38 -43 spot_fleet worker explanation
Line 48: Hyperthreading: reserved for future use, ignore
Line 52
NodeGroupName
: string appears in controller Name taggingAll other field/lines can be ignored in the asset.
Validate and Push the Customized Profile to the MGMT_SERVER
validate it
send it up
Download Scheduler Assets from the Management Server
We will need the private MGMT_SERVER_IP:
Compute AMI Preparation
An AMI is required that is capable of running your workloads. Ideally, this AMI is capable of booting quickly.
Validation of Migratable VM Joined to Your Slurm Cluster
The script test_createVm.sh
exists for a quick validation.
Check the user_data.sh script. This script will be executed in the VM on boot by cloud-init.
Verify paths are correct to slurm binaries by:
Adding SLURM_BIN_DIR to the file:
Searching and replacing all scontrol with ${SLURM_BIN_DIR}/scontrol.
Using a host from the xspot.slurm.conffile, (default values are xspot-vm0[1-9]), and the IMAGE_NAME set previously on line 10 in parse_helper.sh, run test_createVM.sh with the flags and arguments as below:
The script will continuously output updates until the VM is created. When the VM is ready and has joined your Slurm Cluster, the script will exit and you’ll see all the fields in the output are now filled with values:
(Optional) The user_data.sh referenced in step 2 above may need some tuning for your environment:
This step may require several iterations as tuning and troubleshooting are critical to integration.
You can ssh to the VM using the IP reported on the last line of output and validate the environment.
Special consideration and possible temporary tuning in the user_data.sh may be required to allow access to the VM, to troubleshoot issues with services, authentication, and other vital requirements for your environment.
When satisfied that the migratable VM has joined the scheduler, this temporary asset can be cleaned up by killing the job with the following command:
Replace MGMT_SERVER_IP with the IP address of the management server
Replace VM_NAME with the name of the VM (option -h) in step 2
Finalize Integration with Slurm
Create a reference file as a reminder with the prerequsite information:
SLURM_CONF_DIR
,SLURM_BIN_DIR
, andMGMT_SERVER_IP
:
Site-specific customization is required for
resume_xspot.sh
:Add SLURM_BIN_DIR and USER_DATA_FILE to the top of the file with the correct paths:
Search and replace all scontrol with ${SLURM_BIN_DIR}/scontrol.
Specify a log location for autoscaling:
Comment out “Example #1: inline” command below. Uncomment the command below “Example #2: from a file…”
Replace "ImageName": "ubuntu", with "ImageName": "IMAGE_NAME", based on your <IMAGE_NAME> in the parse_helper.sh and test_createVM.sh commands above.
Site-specific customization is required for suspend_xspot.sh:
Specify the same log location for autoscaling:
Add SLURM_BIN_DIR to the top of the file with the correct path:
Search and replace all scontrol with ${SLURM_BIN_DIR}/scontrol.
Edit your
slurm.conf
:Add
include
statement to pick upxspot.slurm.conf
:
Edit
xspot.slurm.conf
:ResumeProgram
: autoscaling of migratable VMs will be handled by${SLURM_CONF_DIR}/assets/xspot_resume.sh
For APC users or others with a preexisting autoscaling solution, we’ll replace the
ResumeProgram
inslurm.conf
with a wrapper to handle both the existing autoscaling and Infrastructure Optimizer’s.
SuspendProgram:
autoscaling of migratable VMs will be cleaned up by${SLURM_CONF_DIR}/assets/xspot_suspend.sh
For APC users, we’ll replace the
SuspendProgram
inslurm.conf
with a wrapper to handle both the APC autoscaling and Infrastructure Optimizer’s.
ResumeRate
, Partition’s “Name”, and Partition’s “OverSubscribe” settings may be reset as best suits your environment. Recommendations are as follows:Set
ResumeRate=100
Set Partition Name to something memorable and distinct, e.g. “exostellar.”
Delete
OverSubscribe=
and everything after it.
Increase the node-count for the NodeName= declaration by increasing the range of node names. By default, the config ships with 9 compute nodes. Multiples of 80 make the most sense with default configs, so change 9 nodes to 800 by replacing:
with
Introducing new nodes into a slurm cluster requires restart of the slurm control deamon:
Integration steps are complete and a job submission to the new partition is the last validation:
As a user, navigate to a valid job submission directory and launch a job as normal, but be sure to specifiy the new partition:
sbatch -p NewPartitionName < job-script.sh