> 3) if it doesn't build, we are on Mac probably, so run sysctl -n > hw.ncpu (I don't have any Mac to test it on, but I guess there > might be a way to actually write the C program in a portable way to > work both on linux and Mac)
So according to this thread: http://www.nabble.com/-patch--libgomp-detect---of-cpus-Darwin-FreeBSD-td19577956.html it seems that the following code should work on Mac: ---------- #include "sys/sysctl.h" #include "stdio.h" int main() { int ncpus = 1; size_t len = sizeof(ncpus); sysctl((int[2]) {CTL_HW, HW_NCPU}, 2, &ncpus, &len, NULL, 0); printf("%d", ncpus); return 0; } ----------------------- On linux it complains that CTL_HW and HW_NCPU are not defined, but according to this FAQ: http://www.osxfaq.com/man/3/sysctl.ws it seems it should be defined in sys/sysctl.h on Mac. So maybe a simple portable C program that works on all platforms could be a solution. Ondrej --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---