Ticket #54104: patch-libcilkrts-runtime-sysdep-tigerfix.diff
File patch-libcilkrts-runtime-sysdep-tigerfix.diff, 1.6 KB (added by kencu (Ken), 8 years ago) |
---|
-
./libcilkrts/runtime/sysdep-unix.c
old new 99 99 //# include <scheduler.h> // Angle brackets include Apple's scheduler.h, not ours. 100 100 #endif 101 101 102 #ifdef __APPLE__ 103 #ifndef __MAC_OS_X_VERSION_MIN_REQUIRED 104 #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 105 #include <Availability.h> 106 #else 107 #include <AvailabilityMacros.h> 108 #endif 109 #endif //#ifndef __MAC_OS_X_VERSION_MIN_REQUIRED 110 111 112 #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050 113 #include <sys/types.h> 114 #include <sys/sysctl.h> 115 #define _SC_NPROCESSORS_ONLN 58 116 117 long tigersysconf(int name){ 118 119 if (name == _SC_NPROCESSORS_ONLN) { 120 int nm[2]; 121 size_t len = 4; 122 uint32_t count; 123 124 nm[0] = CTL_HW; nm[1] = HW_AVAILCPU; 125 sysctl(nm, 2, &count, &len, NULL, 0); 126 127 if (count < 1) { 128 nm[1] = HW_NCPU; 129 sysctl(nm, 2, &count, &len, NULL, 0); 130 if (count < 1) { count = 1; } 131 } 132 133 return (long)count; 134 } 135 return -1; 136 } 137 #endif //#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050 138 #endif //#ifdef __APPLE__ 139 140 141 102 142 #ifdef __linux__ 103 143 # include <sys/resource.h> 104 144 # include <sys/sysinfo.h> … … 733 773 #ifdef __VXWORKS__ 734 774 fprintf(fp, "System cores: %d\n", (int)__builtin_popcount(vxCpuEnabledGet())); 735 775 #else 776 777 #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050 778 fprintf(fp, "System cores: %d\n", (int)tigersysconf(_SC_NPROCESSORS_ONLN)); 779 #else 736 780 fprintf(fp, "System cores: %d\n", (int)sysconf(_SC_NPROCESSORS_ONLN)); 781 #endif 782 737 783 #endif 738 784 fprintf(fp, "Cilk workers requested: %d\n", n); 739 785 #if (PARALLEL_THREAD_CREATE)