On 2 August 2010 15:45, Florian Rathgeber <florian.rathge...@googlemail.com> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, > > I modified FFC to accept an additional option for the -l parameter to > output tensor tabulation code suitable for execution in a CUDA kernel on > the GPU. For that the indexing for coordinates, coefficients and the > element tensor needs to be changed since the data structures look > differently on the GPU (foremost they are flattened). The Jacobi > computations look differently as well due to the way coordinates are stored. > > What I did was to provide a function override_gpu() in cpp.py that > updates the cpp.format dictionary to generate the correct index into the > data structures. This function is called at the beginning of > codegeneration.py:generate_code if the GPU target was specified by the > - -l parameter. > > This works for tensor representation, but not functions values > (including coefficients) for quadrature, since the corresponding code is > generated by the class "QuadratureTransformerBase". I'm no Python > expert, but I assume the override of cpp.format on the global scope is > not visible inside the class scope.
It will be if you call override_gpu() in the representation stage instead of the code generation stage. > Since "QuadratureTransformerBase" does not get the parameters, it cannot > know if the target is GPU and override_gpu() should be called. > > My changes are more of a quick hack and certainly not a well-designed > way to solve this. I would be happy about suggestions both to quickly > fix the quadrature and also how to adapt the whole design to make it > more "clean" and straightforward. We handle the formatting of floats in a similar way so I don't think the solution is too bad for now. > (The corresponding wrapper code, which is different from the ordinary > DOLFIN wrapper code, is also generated depending on the -l option, but > that is a different topic, so I just mention it for the sake of > completeness) and the option is '-l dolfin-gpu' if anyone wonders. Kristian > I published my branch here: > https://code.launchpad.net/~florian-rathgeber/ffc/gpu-wrappers > > Florian > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.12 (MingW32) > > iEYEARECAAYFAkxWy+wACgkQ8Z6llsctAxaqDACgsafJklBYddyOzjbcRP5NCSv1 > /2wAoKoXXkzgCN1xoTHKbKwChDEmmfky > =OXKi > -----END PGP SIGNATURE----- > > > _______________________________________________ > Mailing list: https://launchpad.net/~ffc > Post to : ffc@lists.launchpad.net > Unsubscribe : https://launchpad.net/~ffc > More help : https://help.launchpad.net/ListHelp > > _______________________________________________ Mailing list: https://launchpad.net/~ffc Post to : ffc@lists.launchpad.net Unsubscribe : https://launchpad.net/~ffc More help : https://help.launchpad.net/ListHelp