[Developers] how to use CCTK_RESTRICT
schnetter at cct.lsu.edu
Fri Oct 7 09:51:15 CDT 2005
On Oct 7, 2005, at 08:20:52, Thomas Radke wrote:
> I'm currently doing some investigation on Cactus performance
> profiling and optimisation. One of the things I've tried was using
> restrict pointers in MoL (whether this is a reasonable thing to do
> I'll ask in a separate thread on this mailing list) in the way that
> I define them as in
> const CCTK_REAL* CCTK_RESTRICT RHSVar;
> CCTK_REAL* CCTK_RESTRICT UpdateVar;
> To my surprise I found that the CCTK_RESTRICT macro expands to an
> empty string so that my changes had no effect at all. I made sure
> that the C/C++ compiler (in my case it's Intel) does support the
> qualifier, and the Cactus configure script does recognise it.
> What I don't understand is the logic in lib/make/cctk_Config.h.in
> which defines/undefines CCTK_RESTRICT depending on the value of
> CCTK_C_RESTRICT (and CCTK_CXX_RESTRICT respectively for C++). I
> believe it is a bug that the macro expands to nothing iff
> CCTK_C_RESTRICT is undefined. Or am I missing something here ?
MoL is written in C, and "restrict" is a keyword there, defined in
ANSI C. You should be able to use "restrict" instead of
"CCTK_RESTRICT". Cactus autodetects it properly. Only C++ code has
problems, because Cactus does not #define "restrict" to anything in C+
+, since "restrict" is not a keyword in the C++ standard.
Erik Schnetter <schnetter at cct.lsu.edu>
My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from www.keyserver.net.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://www.cactuscode.org/pipermail/developers/attachments/20051007/da662eda/attachment.bin
More information about the Developers