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
0
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.
0
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 ?
0
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.