aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.7/libgomp/config
Commit message (Collapse)AuthorAgeFilesLines
* Fix GCC 4.4.3/4.6/4.7 openmp support to use libgomp/config/linuxAndrew Hsieh2013-03-073-3/+16
| | | | | | | | | | | | | | | Android does support SYS_gettid and SYS_futex which allows libgomp to use libgomp/config/linux/* instead of libgomp/config/posix and enables more features such as thread affinity. For GCC4.4.3/ARM, the missing linux/futex.h is copied from GCC 4.6 Also guard the new sc_nprocessors_actu with __ANDROID__, and fix return value in proc.c Change-Id: Ib22496075ac5e41c5f44f5160d1b34a5609c168b
* OpenMP: Better CPU count detection for LinuxGeunsik Lim2013-03-061-3/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .PURPOSE This patch is to improve the detection of total CPU count for OpenMP/Linux. This patch helps that OpenMP recognizes the actual CPUs correctly for the task parallelism. Recent mobile devices dynamically disable or enable CPU cores on demand to optimize battery life. This impacts the output of '/proc/cpuinfo' (which only reports active ones). This patch provides a way to compute the total number of cores by parsing the content of '/sys/devices/system/cpu/' instead. Actual CPUs: total installed CPUs Online's CPUs: CPUs of the turn-on status Offline's CPUs: CPUs of the turn-off status Therefore, We need to enhance the existing approach using procfs like '/proc/cpuinfo/' or '/proc/stat'. This patch is suitable for Linux kernel. This patch is based on GCC 4.7.2. .RELATED LINKS: https://android-review.googlesource.com/#/c/52821/ https://android-review.googlesource.com/#/c/51950/ https://android-review.googlesource.com/#/c/51370/ https://android.googlesource.com/toolchain/gcc/ .UNIT TEST int main (int argc, char *argv[]) { int nthreads, tid; printf("SC_NPROCESSORS_ONLN: %d\n", sysconf (_SC_NPROCESSORS_ONLN)); /* Fork a team of threads giving them their own copies of variables */ { /* Obtain thread number */ tid = omp_get_thread_num(); printf("Hello World from thread = %d\n", tid); /* Only master thread does this */ if (tid == 0) { nthreads = omp_get_num_threads(); printf("Number of threads = %d\n", nthreads); } } /* All threads join master thread and disband */ } .LIMITATION OF SCOPE These functions have to be included in Bionic C library as the resource of sysconf(). Examples: _SC_NPROCESSORS_ONLN /proc/stat (= /sys/devices/system/cpu/online) _SC_NPROCESSORS_CONF /proc/cpuinfo (= /sys/devices/system/cpu/online) _SC_NPROCESSORS_ACTU /sys/devices/system/cpu/present (* Future work) .COST EVALUATION OF SYSCALLS (On 32bit Quad core) ------------------------------------------ time seconds usecs/call calls syscall ------------------------------------------ -nan 0.000000 0 3 read -nan 0.000000 0 9 write -nan 0.000000 0 4 open -nan 0.000000 0 4 close -nan 0.000000 0 1 execve -nan 0.000000 0 1 access -nan 0.000000 0 1 brk -nan 0.000000 0 1 munmap -nan 0.000000 0 2 mprotect -nan 0.000000 0 7 mmap2 -nan 0.000000 0 3 fstat64 -nan 0.000000 0 1 set_thread_area ------------------------------------------ 100 0.000000 0 37 total Change-Id: I2c6e41616f309eee89ee1145e92201ffe73463f4 Signed-off-by: Geunsik Lim <leemgs@gmail.com> Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com> Acked-by: Changwoo Min <multics69@gmail.com> CC: David Turner <digit@android.com> CC: Keith Obenschain <obenschaink@gmail.com> CC: Pavel Chupin <pavel.v.chupin@intel.com> CC: Andrew Hsieh <andrewhsieh@google.com>
* Initial check-in of gcc 4.7.2.Ben Cheng2012-10-0140-0/+3633
Change-Id: I4a2f5a921c21741a0e18bda986d77e5f1bef0365