### Aptech Systems, Inc. Worldwide Headquarters

Address:

Aptech Systems, Inc.

2350 East Germann Road, Suite #21

Chandler, AZ 85286Phone: 360.886.7100

FAX: 360.886.8922**Ready to Get Started?**### Request Quote & Product Information

### Industry Solutions

### Products

### Resources

### Support

### Training & Events

Want more guidance while learning about the full functionality of GAUSS and its capabilities? Get in touch for in-person training or browse additional references below.

### Tutorials

Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.

### Have a Specific Question?

### Q&A: Register and Login

### Support Plans

Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.

### User Forums

Join our community to see why our users are considered some of the most active and helpful in the industry!

### Where to Buy

Available across the globe, you can have access to GAUSS no matter where you are.

### Recent Tags

applications character vectors CML CMLMT Constrained Optimization datasets dates dlibrary dllcall econometrics Editor error error codes errors Excel file i/o floating network GAUSS Engine GAUSS Light graphics GUI hotkeys installation license licensing linux loading data loop loops matrix manipulation Maximum Likelihood Maxlik MaxLikMT Memory multidimensional array optimization Optmum output panel data PQG graphics procs random numbers strings structures threading### Recent Questions

- ThreadFor again
- cml.lcg zip file
- nelder-mead optimization algorithm
- Kernel regression - kreg
- exponential matrix
- Panel unit root test with structural breaks - calculating break dates
- Panel unit root test with structural breaks. A problem with the code
- creating subplot
- Output for each loop - output names are also looped
- Dynamic Library Gauss 16 for OS X

### Features

### Time Series 2.0 MT

### Industry Solutions

### Find out more now

### Time Series MT 2.1

### Find out more now

### Find out more now

# Resources

# What are the internally multi - threaded functions in Gauss?

Where can I get a list of the internally multi - threaded functions in Gauss ?

What is the default number of threads of these internally multi - threaded functions ?

Is it possible to change it ? For instance, if I have a 256 cores machine, may I change the default number of cores of the internally multi - threaded functions ?

## 3 Answers

The number of threads created internally by a GAUSS function is dependent upon the computer's resources and the size of the data. GAUSS will use the lesser of: 1) the number of cores available 2) The number of cores that can be profitably used for the calculation in question.

For example, a matrix multiply or linear solve involving matrices that are 5x5 will use only one thread regardless of how many cores your system has, because it will slow down the algorithm to use more than one thread.

However, the same linear algebra operation on a matrix of 1000x1000 can profitably use at least 8 threads (maybe up to 16, depending upon the algorithm). So in this case if more cores are available, GAUSS will use them.

As stated above, the maximum number of threads that GAUSS will create for any function is equal to the number of cores on your system. You cannot increase this. However, you can set a maximum number. This can be controlled with the environment variable OMP_NUM_THREADS.

If your GAUSS code executes many independent iterations and only a small part of it is internally parallelized, then it may be more efficient to split the code up into many threads and use just one or two internal threads per GAUSS thread.

Here is a partial list of internally threaded GAUSS functions:

Matrix multiply

Matrix inversion

Linear solve

Cholesky decomposition

LU decomposition

cdfn, cdfni

All random number generators that have a state as an optional argument i.e. rndn, rndu, rndBeta, rndBinomal,...rndWishart, etc.

and also any function that uses the functions above, for example the function 'ols' uses threaded matrix multiply and inversion internally.

Sorry for the silly question, but,

how do I set up a environment variable such as OMP_NUM_THREADS ?

would it be possible to turn off internal threading lest it interferes with user made threading ?

On Linux the simplest method is to set the environment variable from a shell command prompt like this:

export OMP_NUM_THREADS=1

Setting an environment variable at the shell prompt will set it only for this terminal, so you will need to start GAUSS from the same command prompt.

On Windows 7, you can find instructions at this link.

## Your Answer

## 3 Answers

The number of threads created internally by a GAUSS function is dependent upon the computer's resources and the size of the data. GAUSS will use the lesser of: 1) the number of cores available 2) The number of cores that can be profitably used for the calculation in question.

For example, a matrix multiply or linear solve involving matrices that are 5x5 will use only one thread regardless of how many cores your system has, because it will slow down the algorithm to use more than one thread.

However, the same linear algebra operation on a matrix of 1000x1000 can profitably use at least 8 threads (maybe up to 16, depending upon the algorithm). So in this case if more cores are available, GAUSS will use them.

As stated above, the maximum number of threads that GAUSS will create for any function is equal to the number of cores on your system. You cannot increase this. However, you can set a maximum number. This can be controlled with the environment variable OMP_NUM_THREADS.

If your GAUSS code executes many independent iterations and only a small part of it is internally parallelized, then it may be more efficient to split the code up into many threads and use just one or two internal threads per GAUSS thread.

Here is a partial list of internally threaded GAUSS functions:

Matrix multiply

Matrix inversion

Linear solve

Cholesky decomposition

LU decomposition

cdfn, cdfni

All random number generators that have a state as an optional argument i.e. rndn, rndu, rndBeta, rndBinomal,...rndWishart, etc.

and also any function that uses the functions above, for example the function 'ols' uses threaded matrix multiply and inversion internally.

Sorry for the silly question, but,

how do I set up a environment variable such as OMP_NUM_THREADS ?

would it be possible to turn off internal threading lest it interferes with user made threading ?

On Linux the simplest method is to set the environment variable from a shell command prompt like this:

export OMP_NUM_THREADS=1

Setting an environment variable at the shell prompt will set it only for this terminal, so you will need to start GAUSS from the same command prompt.

On Windows 7, you can find instructions at this link.