Return the thread number, within the current team, of the calling thread.

The omp_get_thread_num routine returns the thread number of the calling thread, within the team executing the parallel region to which the routine region binds. The thread number is an integer between 0 and one less than the value returned by omp_get_num_threads, inclusive. The thread number of the master thread of the team is 0. The routine returns 0 if it is called from the sequential part of a program.


This function always returns 0 when called from within Python.

Returns:The thread number.
Return type:int