ffc team mailing list archive
-
ffc team
-
Mailing list archive
-
Message #03975
Override cpp.format dictionary depending on -l parameter to ffc
-
To:
ffc@xxxxxxxxxxxxxxxxxxx
-
From:
Florian Rathgeber <florian.rathgeber@xxxxxxxxxxxxxx>
-
Date:
Mon, 02 Aug 2010 15:45:16 +0200
-
Openpgp:
id=C72D0316
-
User-agent:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Lightning/0.9 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666
-----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.
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.
(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)
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-----
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
Follow ups