[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HTCondor-users] Parallel Matlab in HTCondor



On Fri, Dec 12, 2014 at 5:52 AM, Werner Hack <werner.hack@xxxxxxxxxx> wrote:

> But what can I do, if I want to use more cores/threads (request_cpus >1) in matlab?
> Can HTCondor provide any info to the matlab job (environment variable? )
> about the assigned request_cpus?
> If I check all environment variables in a job I can not see such info.

Werner,

The job should have a RequestCpus classad that you can query to set
the appropriate matlab variable. The _CONDOR_JOB_AD environment
variable can be used as an easy way to get to the job ad file at the
start of the job. From that file you can get the RequestCpus value. If
you know the cluster you can also query it with condor_q, of course.

For example, if I submit the following:

    cmd = test.sh
    output = out.txt
    request_cpus = 2
    queue

and my executable file test.sh is:

    #!/usr/bin/env bash

    echo $_CONDOR_JOB_AD
    cpus=$(grep ^RequestCpus $_CONDOR_JOB_AD | tr -d ' ' | cut -d= -f2)
    echo "I have $cpus CPUs"
    sleep 1d

I get the number of cpus printed to my output file.

So, instead of sleeping you can invoke matlab and tell it the cpu
count that you requested with request_cpus in your submit file.

Hope that helps,

Louis

---
Louis R. Marascio
512-964-4569