Then yes indeed you timed ListLinePlot and Thread which you should not have done, as you should time only parallelized computation. Timings on window are not useful on the forum as you cannot post actual numbers. Please use AbsoluteTiming around only parallelized code and post actual times. Also click “Reply” to a specific post so responses are nested.
Why do you think that anything else than CUDAFoldList itself would run on the GPU? It’s the only function you are using with CUDA in its name.
The random numbers are not generated on the GPU. Only the FoldList operation runs there. I can’t test on a GPU, but with a list of that size, the operation should take a tiny fraction of a second even on a CPU (0.04 s on my machine if I replace 0 with 0. as the starting value).
Accurate benchmarking is difficult, but for best results try to ensure that the calculation takes at least on the order of 0.1-1 seconds and use AbsouteTiming.
I was unaware that most of the computation time in the above example was spent on generating the graph and not for FoldList operation, this caused the confusion.
I do not think there is a way to do this, unless you write the code from scratch in C. This seems to be the main purpose of CUDALink and OpenCLLink: send your data (packed arrays) to the GPU, run code on them that you developed separately in C (not in Mathematica), copy the result back.
Currently, there is no functionality to run general Mathematica code on the GPU. Even those functions that appear general, such as CUDAFoldList, are in reality restricted to a few specific applications: it can only take Max, Min, Plus, Minus, or Times.
In principle, it should be possible to have a restricted version of Table run on the GPU. Currently, Mathematica can’t do this. Let’s see if the new compiler framework brings improvements here.
RE: “In principle, it should be possible to have a restricted version of Table run on the GPU. Currently, Mathematica can’t do this. Let’s see if the new compiler framework brings improvements here.”
A question: I am not a heavy compiler user but should be; did you get the impression from WTC2021 that things have developed in this respect? Or is it something we need to go find out? Thanks if you can answer.