[sac-user] SaC + cuda

Scholz, Sven-Bodo S.Scholz at hw.ac.uk
Mon Mar 19 21:36:41 CET 2018


Well, I must say I was flabbergasted that it did not work……
I had a look into this…..

The restrictions are as follows:

fold-wlfs are not done by default :-(

if a nesting of WLs occurs *within one function body* the inner WL is *not* done.

I re-wrote your euler into:

int[.] euler(int n)
{
    a = with {
        ([1] <= [i] <= [n]) : relprime(n,i);
    }:genarray([n], 0);

    return a;
}

pushing the summation into main…..

IT STILL DID NOT WORK :-)

and then I remembered that, as of recently, we auto-inline small functions! LOL!

So what the compiler did was to inline euler, and to recombine the summation => BINGO no go!


all that was needed, was to add “noinline” to euler…..:

noinline
int[.] euler(int n)
{
    a = with {
        ([1] <= [i] <= [n]) : relprime(n,i);
    }:genarray([n], 0);

    return a;
}

gives you a cudarized version……..


=> more work on the CUDA magic is clearly needed :-)


Bodo

On 19 Mar 2018, at 18:49, Meyer, Jonathan C <jcm5 at hw.ac.uk<mailto:jcm5 at hw.ac.uk>> wrote:


This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing<http://aka.ms/LearnAboutSpoofing>
        Feedback<http://aka.ms/SafetyTipsFeedback>
Dear Clemens,

I have declared my function as "inline" and SaC now says about the inner "with loop" : "Inner With-loop => no cudarization!".
I suppose it means what it means, that the inner loop in a nested with loop setting can never be "cudarized" ?

However, even the top level "with loop" cannot be "cudarized", still "Body of With-Loop to complex => no cudarization!"

Also, the inner loop calls a function too, which I've tried to inline, with no effect.

Hopefully, since I've quite slowed down by this issue, the source code is very simple (attached).



Thank you for your assistance :-)

Best regards,
Jonathan


________________________________
De : Clemens Grelck <clemens.grelck at googlemail.com<mailto:clemens.grelck at googlemail.com>> de la part de Clemens Grelck <c.grelck at uva.nl<mailto:c.grelck at uva.nl>>
Envoyé : dimanche 18 mars 2018 22:30:07
À : Meyer, Jonathan C; sac-user at sac-home.org<mailto:sac-user at sac-home.org>
Objet : Re: [sac-user] SaC + cuda

Dear Jonathan,

Welcome to the world of SAC.

Have you declared your functions euler and relprime as "inline"?
We don't have an inline heuristics, and the cuda backend does not
like function calls in with-loop bodies.

This goes as follows:
  inline int foo( int a) { return a;}

Apart from that it might indeed be useful to see your complete
source code, assuming it's not exactly gigantic. ;-)

Cheers,
  Clemens


On 3/18/18 12:21 AM, Meyer, Jonathan C wrote:
Dear all,

First, I am a total beginner to SaC and functional programming in general.
I would therefore greatly appreciate any help :)

I have managed to write some code that works fine using target "mt_pth", with working parallelization.
However, despite my desperate tries, SaC can't make it work on GPUs -> "Body of With-Loop to complex => no cudarization!".

The loops are :

- [In main()]
a = with{
                ([0,0] <= [i,j] < [15,1000]) : euler(i*1000+j+1);
}:fold(+, 0);


- [In euler()]
a = with {
                ([1] <= [i] <= [n]) : relprime(n,i);

 }:fold(+, 0);



For reference, the goal is to compute the sum of totient in a given range of integers.
If needed, I attached my source code.

Thank you for your help !

Best regards,
Jonathan
________________________________
Heriot-Watt University is The Times & The Sunday Times International University of the Year 2018
Founded in 1821, Heriot-Watt is a leader in ideas and solutions. With campuses and students across the entire globe we span the world, delivering innovation and educational excellence in business, engineering, design and the physical, social and life sciences.
This email is generated from the Heriot-Watt University Group, which includes:

  1.  Heriot-Watt University, a Scottish charity registered under number SC000278
  2.  Edinburgh Business School a Charity Registered in Scotland, SC026900. Edinburgh Business School is a company limited by guarantee, registered in Scotland with registered number SC173556 and registered office at Heriot-Watt University Finance Office, Riccarton, Currie, Midlothian, EH14 4AS
  3.  Heriot- Watt Services Limited (Oriam), Scotland's national performance centre for sport. Heriot-Watt Services Limited is a private limited company registered is Scotland with registered number SC271030 and registered office at Research & Enterprise Services Heriot-Watt University, Riccarton, Edinburgh, EH14 4AS.

The contents (including any attachments) are confidential. If you are not the intended recipient of this e-mail, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete it (including any attachments) from your system.



_______________________________________________
sac-user mailing list
sac-user at sac-home.org<mailto:sac-user at sac-home.org>
http://lists.sac-home.org/mailman/listinfo/sac-user




--
----------------------------------------------------------------------
Dr Clemens Grelck                                     Science Park 904
University Lecturer                                   1098XH Amsterdam
Programme Director Software Engineering                    Netherlands

University of Amsterdam
Institute for Informatics                        T +31 (0) 20 525 8683
System and Network Engineering Lab               F +31 (0) 20 525 7490

Office C3.109                             staff.fnwi.uva.nl/c.u.grelck<http://staff.fnwi.uva.nl/c.u.grelck>
----------------------------------------------------------------------


<test2.sac>_______________________________________________
sac-user mailing list
sac-user at sac-home.org<mailto:sac-user at sac-home.org>
http://lists.sac-home.org/mailman/listinfo/sac-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sac-home.org/pipermail/sac-user/attachments/20180319/9a6545d4/attachment.html>


More information about the sac-user mailing list