Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.
1696 Discussions

sir is there any command to check weather the system dualcore or quadcore or 8core

sabbinenisunil
Beginner
477 Views
if there is any comman like that in c language please inform me.this is because iam doing automatic parallelisation project using openmp libraries.to do that one first of all i have to check weather it is quad core or dual core . based on that one i have to assign the threads.
please reply me sir
0 Kudos
3 Replies
TimP
Honored Contributor III
477 Views
Not in C language, but you may be interested in sample OpenMP code, e.g.
#ifdef _OPENMP
#include
#endif
..........

#ifdef _OPENMP
int maxt=omp_get_max_threads();
....

If you are trying to distinguish a single CPU 8 core from dual 4 core, you will require vendor-dependent code.
0 Kudos
Tamer_Assad
Innovator
477 Views

Hi sabbinenisunil,

You may start this by recognizing the processor type using IPP functions, each type has its pre-known features and number of cores.

Please check the following thread:
http://origin-software.intel.com/en-us/forums/showthread.php?t=71133

also, please check the following articles:

1) Is there an IPP function to detect the processor type?

http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-is-there-any-function-to-detect-processor-type/

2) IPP Dispatcher Control Functions - ipp*Init*() functions

http://software.intel.com/en-us/articles/ipp-dispatcher-control-functions-ippinit-functions/

3) Understanding CPU Dispatching in the Intel IPP

http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-understanding-cpu-optimized-code-used-in-intel-ipp/

Regards,

Tamer Assad

0 Kudos
MOHAMMED_IRFANULLA_S
477 Views

Hi,

In Java, this is very easy to know.
Below is a snippet for your reference.

public class PerfTest {
public static void main(String[] args) {
int processors = Runtime.getRuntime().availableProcessors();
System.out.println("Available processors : " + processors);
}
}

Regards,
Md. Irfanulla S.
0 Kudos
Reply