There are two ways affinity can be set in Slurm and that is to a specific logical processor (socket, core, or thread) or set above the logical processor (core or thread) such as NUMA locality domains.
Slurm muilt-core / mulit-thread
In the sporc environment affinity will need to be applied with the srun command.
srun -n 8
The example above is using the ldoms flag which is an auto-generated mask that binds to a NUMA locality domain or domains. Has the request for cores approaches the total cores per processor the likelihood that a job's tasks will be spread across multiple NUMA domains increases. To minimize the number of NUMA domains use the --cpu-bind=ldoms flag. If the number of requested cores is less than the total cores per processor all tasks should be in the same NUMA locality domain.
This is also true for sinteractive, which is effectively just srun inside of a bash script.