trying to do setenv OMP_NUM_THREADS 8

if at the prompt in a shell I do setenv OMP_NUM_THREADS 4 that is successful. And my program runs on 4 cores if i launch it.

But I have a file called runme where it is only this

cd /scratch/run1

my crunch_numbers.x program is parallelized with openMP and uses the OMP_NUM_THREADS environment variable.

Problem is crunch_numbers when run by the runme script runs on 4 cores and not 8. the setting of OMP_NUM_THREADS within my script has no effect. How can i make the setenv in the script effective ?

Also, my shell is /bin/tcsh. I don't plan on using this in a bash shell. thanks.

  • that is your whole script? Didn't you forgot about Shebang? Please update the question with specific information how do you run the script, with specific proof of non-working. Minimal example would be appreciated.
    – Jakuje
    Apr 8 '16 at 20:37

If you prefer using tcsh, your script should say so, by putting this at the beginning:

#!/bin/tcsh -f

The #!/bin/tcsh tells the kernel to run that program rather than #/bin/sh, and the -f option reminds tcsh not to reinitialize itself.

Further reading:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.