mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Software (https://www.mersenneforum.org/forumdisplay.php?f=10)
-   -   Mac OS X programmers? (https://www.mersenneforum.org/showthread.php?t=7939)

Prime95 2007-04-21 21:05

Mac OS X programmers?
 
Any out there?

I'm somewhat lazy. Does anyone know the Mac OS X C code to:

1) Get amount of physical memory installed
2) Get thread ID
3) Set thread affinity
4) Set thread priority
5) Find battery vs. AC power state

rogue 2007-04-21 23:22

nice() should be able to set the priority.

Andreas.Jantos 2007-04-26 12:38

Since I'm also lazy and not a Mac OS X programmer, I will just give you some hints and pointers to the appropriate documentation:

1) sysctl(3) is your friend (HW_PHYSMEM):[URL="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/sysctl.3.html"] http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/sysctl.3.html[/URL]

2) pthread_self(3) might help:[URL="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/pthread_self.3.html"] http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/pthread_self.3.html[/URL]

3) sorry, no clue (and couldn't find anything on apple's site using a quick search)

4) I don't know nice() as a C routine, but just as a command line tool which sets the priority of a process, better suited might be a sequence of pthread_getschedparam(3) and pthread_setschedparam(3):[URL="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/pthread_setschedparam.3.html"] http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/pthread_setschedparam.3.html[/URL]
or perhaps even simpler pthread_attr_getschedparam(3) and pthread_attr_setschedparam(3):[URL="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/pthread_attr_setschedparam.3.html"] http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/pthread_attr_setschedparam.3.html[/URL]
also helpful might be the man page for setpriority(2): [URL]http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/setpriority.2.html[/URL]

5) no clue.

An index of man pages can be found there:[URL="http://developer.apple.com/documentation/Darwin/Reference/ManPages/index.html"] http://developer.apple.com/documentation/Darwin/Reference/ManPages/index.html[/URL]
Sections 2 and 3 are the most relevant to C programming.

I will continue to search for solutions to questions 3) and 5) - as I'm waiting since January for a Mac OS X GIMPS client. But I hope this might help at least a bit...

Prime95 2007-04-26 21:47

[QUOTE=Andreas.Jantos;104624] as I'm waiting since January for a Mac OS X GIMPS client. But I hope this might help at least a bit...[/QUOTE]

A completely untested v25 client is at [url]ftp://mersenne.org/gimps/mprime252osXalpha.tgz[/url]

Do not use it to contact the server. If you are real lucky, it might can do some manual tests.

Ethan (EO) 2007-04-30 15:36

[QUOTE=Prime95;104689]A completely untested v25 client is at [url]ftp://mersenne.org/gimps/mprime252osXalpha.tgz[/url]

Do not use it to contact the server. If you are real lucky, it might can do some manual tests.[/QUOTE]


George --

It seems to work fine! I haven't done exhaustive testing, but the menu works as expected, benchmarks and torture test work fine, and cpu detection seems to be accurate. All noted on a very early MacBook Pro running 10.4.9.


Thanks!

Ethan O'Connor (Primenet EO)

Ethan (EO) 2007-05-01 02:19

[QUOTE=Ethan (EO);104950]George --

It seems to work fine! I haven't done exhaustive testing, but the menu works as expected, benchmarks and torture test work fine, and cpu detection seems to be accurate. All noted on a very early MacBook Pro running 10.4.9.
[/QUOTE]

Well --
[CODE]
[Apr 30 22:17] Torture Test ran 10 hours, 42 minutes - 0 errors, 0 warnings.
[Apr 30 22:17] Work thread stopped.
[Apr 30 22:17] Execution halted.[/CODE]

:tu:

Again, this is on a 1.83GHz Core Duo MacBook Pro running 10.4.9.

Prime95 2007-05-01 03:33

You may not care but multi-threaded FFTs don't work. I'm trying to figure out why.

Ethan (EO) 2007-05-02 15:16

[QUOTE=Prime95;104992]You may not care but multi-threaded FFTs don't work. I'm trying to figure out why.[/QUOTE]

I haven't had time to dig in at all, but there are a few other behavioral oddities going on -- occasionally the program will get into a state where selecting a menu item that should start a test or benchmark results in an immediate "all worker threads stopped; hit enter to continue" (paraphrased).

When the program is in this state (and sometimes when it is not) there appears to be stack corruption in the main thread, at least according to the activity monitor's sampling profiler. I've been too busy to verify if that's actually true or is an artifact of something else. Let me know if I can be of any assistance -- can you build a debug version and put it on the ftp site?

Ethan

crash893 2007-05-23 06:17

[QUOTE=Prime95;104689]A completely untested v25 client is at [url]ftp://mersenne.org/gimps/mprime252osXalpha.tgz[/url]

Do not use it to contact the server. If you are real lucky, it might can do some manual tests.[/QUOTE]


this is for intel based macs right?

Prime95 2007-05-23 13:16

[QUOTE=crash893;106797]this is for intel based macs right?[/QUOTE]

Correct.

crash893 2007-05-25 05:44

is there any feed back you need specifically?


All times are UTC. The time now is 05:56.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.