mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   GPU Computing (https://www.mersenneforum.org/forumdisplay.php?f=92)
-   -   mfakto: an OpenCL program for Mersenne prefactoring (https://www.mersenneforum.org/showthread.php?t=15646)

Bdot 2014-01-02 19:50

[QUOTE=kracker;363578]Is this automatic? Or do I have to manually do something for those kernels?

Thanks! :smile:[/QUOTE]
All plain and out-of-the-box.

kracker 2014-01-02 20:55

1 Attachment(s)
After a crapload of errors... it has "appeared" :toot: Now to see if it works... :smile:

sched_setaffinity is I found out is only for linux... lol It didn't "define" it because it wasn't MSVC.

Bdot 2014-01-02 21:43

You could not use SetThreadAffinityMask?

kracker 2014-01-02 22:18

[QUOTE=Bdot;363613]You could not use SetThreadAffinityMask?[/QUOTE]

Not sure, I used the code for MSVC. mfakto in general seems to be working, though :smile:

Bdot 2014-01-04 02:34

I just checked in a version that reads a "MoreClasses" config item (only when GPU-sieving, I did not want to touch the CPU sieve). MoreClasses=0 seems to have advantages when the time per class is below 0.4-0.5 seconds (on my old 5770).

kracker 2014-01-04 16:48

Thanks! Will check it out later this evening... :smile:

kracker 2014-01-05 01:07

Nice...! :smile:

Running 6M 63 to 64, I get 207 from 193 :smile:

EDIT: Ok, I believe I fixed SieveCPUMask on MinGW/gcc,
[code]
mfaktc.c

#include <stdio.h>
#include <stdlib.h>
#ifndef _MSC_VER
#include <unistd.h>
#define _GNU_SOURCE
#include <sched.h>
#endif
#ifndef __MINGW32_
#include <windows.h>
#endif
#include <string.h>
#include <errno.h>
#include <time.h>
#include <CL/cl.h>
[/code]

[code]
mfaktc.c line 1183

#if defined _MSC_VER || __MINGW32__
SetThreadAffinityMask(GetCurrentThread(), mystuff.cpu_mask);
#else
sched_setaffinity(0, sizeof(mystuff.cpu_mask), mystuff.cpu_mask);
#endif
[/code]

Bdot 2014-01-05 23:41

I've committed your second part, but skipped the first (including windows.h is no good, and did not apply to MinGW anyway).
[code]
--- a/src/mfaktc.c
+++ b/src/mfaktc.c
@@ -1180,7 +1180,7 @@ int main(int argc, char **argv)
// no need to do this if we're sieving on the GPU
if (mystuff.cpu_mask)
{
[COLOR=red]-#ifdef _MSC_VER[/COLOR]
[COLOR=green]+#if defined _MSC_VER || __MINGW32__[/COLOR]
SetThreadAffinityMask(GetCurrentThread(), mystuff.cpu_mask);
#else
sched_setaffinity(0, sizeof(mystuff.cpu_mask), mystuff.cpu_mask);
[/code]

kracker 2014-01-06 00:10

Hmm, I see. I tried compiling mfakto again with newest commit, it doesn't work.

(fyi, mingw does have a windows.h in the "core" includes [URL="http://pastebin.com/YfjkBQ4P"]windows.h[/URL]

Anyways, here it is with cpu sieving:
[URL="http://imagebin.org/285341"]http://imagebin.org/285341
[/URL]

This is with windows.h included.
[URL="http://imagebin.org/285342"]http://imagebin.org/285342[/URL]

PS: Also on filelocking.c it compiles when I change line28 to
[code]
#if defined _MSC_VER || __MINGW32__
[/code]

Sorry I didn't say so in previous post. :bangheadonwall:

Thanks :smile:

Bdot 2014-01-06 00:26

Where did you include windows.h? Your code block had an "#ifndef __MINGW32_" in front of it ...

And it does not compile in VS10 when that windows.h is there, and probably neither on Linux.

I added the filelocking.c change as well, but did not yet commit.

BTW, "git diff" gives you all changes made in your working copy :wink:
And I made you contributor for the github repo.

kracker 2014-01-06 01:04

[QUOTE=Bdot;363904]Where did you include windows.h? Your code block had an "#ifndef __MINGW32_" in front of it ...

And it does not compile in VS10 when that windows.h is there, and probably neither on Linux.

I added the filelocking.c change as well, but did not yet commit.

BTW, "git diff" gives you all changes made in your working copy :wink:
And I made you contributor for the github repo.[/QUOTE]

:facepalm:

I have a lot of different files lying around... it is "#ifndef __MINGW32__".

This is in mfaktc.c.

EDIT: I have frankly, never tried git :smile: I'll see if I can find a guide, will probably be useful in the future.

EDIT2: Ah screw this, brain is too foggy now >_<. Trying tomorrow.


All times are UTC. The time now is 23:09.

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