There are 6 cores while there are 12 threads. If using openmp, is there any performance difference if I create 6 threads and create 12 threads?
It would require a fairly unusual workload for OpenMP to gain an advantage by running 2 threads per core. It's possible, particularly if you can set affinity so that pairs of threads get an advantage by sharing data in cache. Intel OpenMP will use all 12 logical processors by default, but will not set the necessary affinity by default. The documentation for Intel MKL library explains why that library tries to avoid running 2 threads per core.I have benchmarks where the performance of Xeon 5680 (in the normal configuration of 2 CPUs, 12 cores total) gets peak OpenMP performance with 8 threads, with affinity set to use only the 8 independent cores. More typically, going from 4 to 6 threads per CPU can give 20% performance increase. The one thing you can be sure of when leaving HyperThreading active is that affinity setting is critical.