#!/usr/bin/perl

@thread_list = (2, 4, 8);


sub generate_submit_file {

    $thread_id = shift;
    
    $share_string = "not_shared";

    $file_name = "llsubmit_${thread_id}";
    open(FILE, ">$file_name");

print FILE <<EOF;

#@ shell = /bin/bash
#@ initialdir = YOUR_DIRECTORY_PATH
#@ account_no = A-cs41
#@ job_name = pthread_${thread_id}
#@ input = /dev/null
#@ output = \$(job_name).o\$(jobid)
#@ error = \$(job_name).o\$(jobid)
#@ job_type = parallel
#@ environment = COPY_ALL; LL_JOB=TRUE;AIXTHREAD_MINKTHREADS=${thread_id}; AIXTHREAD_MNRATIO=1:1; MP_SINGLE_THREAD=NO; OMP_NUM_THREADS=${thread_id}
#@ resources = ConsumableCpus(${thread_id}) ConsumableMemory(500mb)
#@ network.MPI_LAPI = sn_all, not_shared, US
#@ wall_clock_limit = 01:00:00
#@ node = 1
#@ tasks_per_node = 1
#@ node_usage = ${share_string}
#@ notify_user = YOUR_EMAIL_ID 
#@ notification = complete
#@ class = normal
#@ queue
export OMP_NUM_THREADS=${thread_id}
./PROGRAM_NAME ARGUMENTS

EOF

    close(FILE);


}


foreach $thread(@thread_list) {
    generate_submit_file($thread);
}

