When running IBM Spectrum LSF on AWS, you may need to fine‑tune how many vCPUs an EC2 instance presents to the operating system. This can be especially useful when you want tighter control over resource scheduling, licensing cost, or workload shaping. AWS EC2 provides CPU Options that allow you to configure threads per core and core count— and then simply align an LSF AWS provision template with your customized vCPU values.
In this blog, we'll walk through:
- Why customizing vCPUs matters
- How to set CPU Options in an EC2 launch template
- How to align these CPU settings with your LSF
awsprov_template.json
- An example with a t3.2xlarge instance type
Why Customize vCPUs in EC2?
By default, an EC2 instance launches with the full core and thread count supported by the instance type. But AWS also allows you to reduce the number of visible vCPUs through CPU Options. This enables use cases such as:
- Reduce license cost by CPU counts
- Disable hyperthreading
To make this effective in LSF, both the EC2 launch template settings and the LSF Resource Connector definitions must be consistent.
Step 1: Configure CPU Options in an EC2 Launch Template
When creating an EC2 launch template, AWS provides the option to manually configure:
- Number of threads per core
- Number of CPU cores
This directly determines the number of active vCPUs presented to the OS:
vCPUs = (threads per core) * (number of cores)
On a t3.2xlarge instance type — which normally has:
- 2 threads per cores * 4 cores = 8 active vCPUs
For example, a custom configuration could be reduce as follows:
- 1 thread * 2 cores = 2 active vCPUs
Note, the above was the minimum vCPUs allowed for this instance type.
Step 2: Align LSF Configuration (awsprov_template.json)
Once the EC2 launch template is configured, the LSF provision template configuration must be aligned with the same number of vCPUs that the launch template will actually provide. This is done inside the AWS provisioning template:
awsprov_template.json
Within the attributes section of the template, set:
"attributes": {
"ncpus": ["Numeric", "<Your_Active_vCPUs>"],
The ncpus attribute value must match the active vCPUs defined in the EC2 launch template.
If there is a mismatch between the LSF provision template's ncpus and the active vCPUs in the EC2 launch template, LSF scheduling decisions will be incorrect:
- LSF might provision fewer instances than needed for pending workload
- LSF might mis-provision instances intending to use them for jobs that require more vCPUs
Example: t3.2xlarge with Reduced CPU Count
Here is a summary of the example above:
Instance type: t3.2xlarge
Default vCPUs: 8 (2 threads * 4 cores)
Custom CPU Options configured in the launch template:
- Threads per core: 1
- Cores: 2
Resulting active vCPUs: 2
LSF awsprov_template.json entry:
{
"templateId": "Your_Example_1",
"maxNumber": 5,
"priority" : 80,
attributes": {
"ncpus": ["Numeric", "2"],
...
},
"launchTemplateId" : "<Your_Launch_Template_Id_Here>",
"launchTemplateVersion" : "$Latest",
...
}
This ensures LSF sees the correct number of vCPUs and schedules jobs accordingly.
Final Thoughts
Customizing vCPU counts in EC2 is a powerful way to shape how compute resources behave in LSF-managed environments. When adjusting CPU Options:
- Review the Supported CPU options for Amazon EC2 instance types
- Set the desired thread and core configuration in the EC2 launch template.
- Mirror the resulting vCPU count in the LSF
awsprov_template.jsontemplate.
This keeps LSF provisioning, scheduling, and auto-scaling aligned with the actual OS servers provisioned.