Skip to content

Commit

Permalink
add GPUs to BSUB test
Browse files Browse the repository at this point in the history
  • Loading branch information
hpratt committed Oct 21, 2023
1 parent b1f3f9e commit 4d1fe79
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ plugins {
}

group = "io.krews"
version = "0.14.4"
version = "0.14.5"

repositories {
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
mavenCentral()
jcenter()
mavenLocal()
}

dependencies {
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/krews/config/BsubConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ data class BsubWorkflowConfig(
data class BsubTaskConfig(
// Number of cpus. Can be used to override the runtime value.
val cpus: Int? = null,
// Whether or not to request a GPU.
val gpu: Boolean? = null,
// Memory capacity. Can be used to override the runtime value.
val mem: Capacity? = null,
// Time limit on the run time for the job in minutes.
val time: Int? = null,
// SBatch partition to use.
val partition: String? = null,
// Additional sbatch arguments
// Additional bsub arguments
val sbatchArgs: Map<String, String>? = null
)
2 changes: 2 additions & 0 deletions src/main/kotlin/krews/executor/bsub/BsubExecutor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class BsubExecutor(private val workflowConfig: WorkflowConfig) : LocallyDirected
val cpus = taskConfig.bsub?.cpus ?: taskRunContexts.map { it.cpus }.maxBy { it ?: -1 }
val timePerTask = taskConfig.bsub?.time ?: taskRunContexts.map { it.cpus }.maxBy { it ?: -1 }
val time = if (timePerTask != null) timePerTask * taskRunContexts.size else null
val gpus = taskConfig.bsub?.gpu ?: "\"\""

appendBsubParam(bsubScript, "J", bsubWorkflowJobName)
appendBsubParam(bsubScript, "o", logsPath.resolve("out.txt"))
Expand All @@ -84,6 +85,7 @@ class BsubExecutor(private val workflowConfig: WorkflowConfig) : LocallyDirected
appendBsubParam(bsubScript, "n", cpus)
appendBsubParam(bsubScript, "W", time)
appendBsubParam(bsubScript, "q", taskConfig.bsub?.partition)
appendBsubParam(bsubScript, "gpu", gpus)
for ((argName, argVal) in taskConfig.bsub?.sbatchArgs ?: mapOf()) {
appendBsubParam(bsubScript, argName, argVal)
}
Expand Down

0 comments on commit 4d1fe79

Please sign in to comment.