# About the "-th" command

**URL:** <https://castor-project.discourse.group/t/about-the-th-command/452>\
**Category:** General Discussions\
**Created:** [December 13, 2022, 7:44am UTC](https://castor-project.discourse.group/t/about-the-th-command/452 "2022-12-13T07:44:18Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuanhang](https://avatars.discourse-cdn.com/v4/letter/y/ec9cab/32.png) [@yuanhang](https://castor-project.discourse.group/u/yuanhang)\
**Post date:** [December 13, 2022, 7:44am UTC](https://castor-project.discourse.group/t/about-the-th-command/452/1 "2022-12-13T07:44:18Z")

</div>

Hello everyone  
I’m trying to use the multithreading provided by castor, I used the command “-th 4”, but the software says I need to run it with the CASTOR\_OMP environment variable set to 1. I used the command “export CASTOR\_OMP=1” to set the environment variable and “make” the castor again, but I still have the above reminder when running. How can I solve this problem? I would be grateful for any answer.

 ![image](https://global.discourse-cdn.com/free1/uploads/castor_project/original/1X/d23480d6584be7aa51c918ef8b52b660cf5722df.png)

---

<div class="post-metadata">

**Author:** ![Maxime\_Toussaint](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Maxime\_Toussaint](https://castor-project.discourse.group/u/Maxime_Toussaint)\
**Post date:** [December 13, 2022, 2:02pm UTC](https://castor-project.discourse.group/t/about-the-th-command/452/2 "2022-12-13T14:02:39Z")

</div>

Greetings,

Is it possible that you forgot to re-generate the cmake files before launching make?

In short, use either ccmake or export+cmake to enable CASToR\_OMP (see section 3.4 of the guide, if needed), generate the cmake files (“c” abd “g” with ccmake, no idea with cmake) and then run make.

Note: Sometime, cmake re-generate behave weirdly and it is better to restart fresh to create the cmake files.

Bests,  
Maxime Toussaint

---

<div class="post-metadata">

**Author:** ![tmerlin](https://yyz2.discourse-cdn.com/free1/user_avatar/castor-project.discourse.group/tmerlin/32/216_2.png) [@tmerlin](https://castor-project.discourse.group/u/tmerlin)\
**Post date:** [December 14, 2022, 3:55pm UTC](https://castor-project.discourse.group/t/about-the-th-command/452/3 "2022-12-14T15:55:08Z")

</div>

Hi,

Using the standard makefile for compilation, make sure you cleaned everything (make clean) after you changed this environment variable. The Makefile does not automatically check than an environment variable has been changed, so most probably you get this error because the code has not been recompiled with openMP.

tl;dr: try _make clean_ before recompiling with _make -j_

Best,  
Thibaut

---

<div class="post-metadata">

**Author:** ![yuanhang](https://avatars.discourse-cdn.com/v4/letter/y/ec9cab/32.png) [@yuanhang](https://castor-project.discourse.group/u/yuanhang)\
**Post date:** [December 20, 2022, 7:34am UTC](https://castor-project.discourse.group/t/about-the-th-command/452/4 "2022-12-20T07:34:41Z")

</div>

I’m sorry I replied too late because I was sick. I used the standard “make” instead of “cmake”, but thanks for the reply anyway.

---

<div class="post-metadata">

**Author:** ![yuanhang](https://avatars.discourse-cdn.com/v4/letter/y/ec9cab/32.png) [@yuanhang](https://castor-project.discourse.group/u/yuanhang)\
**Post date:** [December 20, 2022, 7:36am UTC](https://castor-project.discourse.group/t/about-the-th-command/452/5 "2022-12-20T07:36:00Z")

</div>

Hi,  
I’m sorry I replied too late because I was sick. Thanks for your response, I will follow your advice.

---

<div class="post-metadata">

**Author:** ![yuanhang](https://avatars.discourse-cdn.com/v4/letter/y/ec9cab/32.png) [@yuanhang](https://castor-project.discourse.group/u/yuanhang)\
**Post date:** [December 20, 2022, 9:45am UTC](https://castor-project.discourse.group/t/about-the-th-command/452/6 "2022-12-20T09:45:46Z")

</div>

Hi,

I made the change as you suggested and when I looked at the environment variables I found that the change did succeed, but when I ran I still had the previous problem and the software prompted me to still be single-threaded.

![image](https://global.discourse-cdn.com/free1/uploads/castor_project/original/1X/ea1f408b2471a2fc60a44d916093a7c97eae0119.jpeg)

 ![image](https://global.discourse-cdn.com/free1/uploads/castor_project/original/1X/13132c78fb1c3c9bbfdc8db66c334f2d8d77ff15.png)

---

<div class="post-metadata">

**Author:** ![sstute](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@sstute](https://castor-project.discourse.group/u/sstute)\
**Post date:** [December 20, 2022, 10:43am UTC](https://castor-project.discourse.group/t/about-the-th-command/452/7 "2022-12-20T10:43:40Z")

</div>

Hi,

It seems that you are using the DEBUG mode (CASTOR\_DEBUG).

If you do not know why, then unset this variable and redo the compilation.

By the way, do not set the CASTOR\_VERBOSE variable either.

These variables are used for debugging, and the DEBUG variable disable the multi-threading by default.

Best

Simon

---

<div class="post-metadata">

**Author:** ![yuanhang](https://avatars.discourse-cdn.com/v4/letter/y/ec9cab/32.png) [@yuanhang](https://castor-project.discourse.group/u/yuanhang)\
**Post date:** [December 20, 2022, 11:12am UTC](https://castor-project.discourse.group/t/about-the-th-command/452/8 "2022-12-20T11:12:44Z")

</div>

Hi,

Thanks for your response, I will follow your advice.

Best

YuanHang

---

<div class="post-metadata">

**Author:** ![yuanhang](https://avatars.discourse-cdn.com/v4/letter/y/ec9cab/32.png) [@yuanhang](https://castor-project.discourse.group/u/yuanhang)\
**Post date:** [December 21, 2022, 8:02am UTC](https://castor-project.discourse.group/t/about-the-th-command/452/9 "2022-12-21T08:02:00Z")

</div>

Hi Simon,

II tried setting the variables “DEBUG” and “VERBOSE” to “0” before compiling, and compiling them before setting them to “0,” but once they were set to “0,” they couldn’t compile. Do you know what the problem is?  
 ![image](https://global.discourse-cdn.com/free1/uploads/castor_project/original/1X/e8bea53341d826ce2a5729f9044f281647d29f00.png)

Best

YuanHang

---

<div class="post-metadata">

**Author:** ![sstute](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@sstute](https://castor-project.discourse.group/u/sstute)\
**Post date:** [December 21, 2022, 8:31am UTC](https://castor-project.discourse.group/t/about-the-th-command/452/10 "2022-12-21T08:31:37Z")

</div>

Hi,

Disable also the CASTOR\_MPI variable.

In general, think about enabling something only if you need it.

Basically, in your case, only enable CASTOR\_OMP and correctly set the variable CASTOR\_CONFIG.

Best  
Simon
