Skip to content

Commit

Permalink
Merge pull request #161 from rynge/cpu-only-gpus
Browse files Browse the repository at this point in the history
Replaced CPUJOB_ON_GPUSLOT with the new RoomForCPUOnlyJobs
  • Loading branch information
matyasselmeci committed Dec 13, 2023
2 parents d0a67f9 + ace88c5 commit 9a2c30d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
8 changes: 0 additions & 8 deletions 10-setup-htcondor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -501,14 +501,6 @@ if [ "x$OSG_SQUID_LOCATION" != "x" ]; then
export http_proxy="$OSG_SQUID_LOCATION"
fi

# some admins prefer to reserve gpu slots for gpu jobs, others
# want to run cpu jobs if there are no gpu jobs available
if is_true "$ALLOW_CPUJOB_ON_GPUSLOT"; then
echo "CPUJOB_ON_GPUSLOT = True" >> "$PILOT_CONFIG_FILE"
else
echo "CPUJOB_ON_GPUSLOT = ifThenElse(MY.TotalGPUs > 0 && MY.GPUs > 0, TARGET.RequestGPUs > 0, True)" >> "$PILOT_CONFIG_FILE"
fi

cat >$LOCAL_DIR/user-job-wrapper.sh <<EOF
#!/bin/bash
set -e
Expand Down
6 changes: 5 additions & 1 deletion 50-main.config
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ STARTD_ATTRS = $(STARTD_ATTRS) GLIDEIN_Country GLIDEIN_Site GLIDEIN_ResourceName
# Some attributes used (OSG_NODE_VALIDATED, IsBlackHole, HasExcessiveLoad, ...) might
# not be used/defined by all VOs, so we explicitly check if they are defined before
# using them as part of the START expression.
#
# For GPU containers, we check if we can fit some CPU-only jobs with RoomForCPUOnlyJobs
START = (time() < GLIDEIN_ToRetire) && \
(ifThenElse(TARGET.JobDurationCategory =?= "Long", GLIDEIN_ToDie - time() > 144000, True)) && \
(isUndefined(MY.OSG_NODE_VALIDATED) || MY.OSG_NODE_VALIDATED) && \
Expand All @@ -64,7 +66,9 @@ START = (time() < GLIDEIN_ToRetire) && \
((DESIRED_Sites=?=undefined) || stringListMember(GLIDEIN_Site,DESIRED_Sites,",")) && \
((UNDESIRED_Sites=?=undefined) || !stringListMember(GLIDEIN_Site,UNDESIRED_Sites,",")) && \
(!isUndefined(TARGET.ProjectName)) && \
($(CPUJOB_ON_GPUSLOT)) && \
((MY.GPUs ?: 0) == 0 || \
(TARGET.RequestGPUs ?: 0) > 0 || \
RoomForCPUOnlyJobs is Undefined || RoomForCPUOnlyJobs) && \
(isUndefined(TARGET.SingularityImage) || MY.SINGULARITY_START_CLAUSE) && \
(TARGET.Want_MPI =!= True || MY.Has_MPI =?= True) && \
(START_EXTRA ?: true) && (OSG_PROJECT_RESTRICTION ?: true)
Expand Down
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,6 @@ ENV SINGULARITY_BIND_EXTRA=
# Additional restrictions for your START expression
ENV GLIDEIN_Start_Extra=

# Allow CPU jobs on GPU slots if there are GPUs left
ENV ALLOW_CPUJOB_ON_GPUSLOT=false

# Use the prepare-job-hook to run Singularity jobs
ENV CONTAINER_PILOT_USE_JOB_HOOK=true

Expand Down

0 comments on commit 9a2c30d

Please sign in to comment.