Cactus does not detect `gettimeofday` timer
The gettimeofday
timer is not available any more in Cactus. This is the main timer used by Cactus to measure elapsed time.
PR https://bitbucket.org/cactuscode/cactus/pull-requests/153 corrects this.
Comments (9)
-
-
- changed status to open
-
-
assigned issue to
-
assigned issue to
-
reporter Yes, this is forbidden. Consider e.g. a global variable declaration, or the definition of an inline function. These have very different meaning when inside a function, or are not allowed.
-
The global variable declaration I don’t buy. Since those look like:
extern int errno
whether they are in the function or not does not matter (and the
extern
is required for the declaration otherwise it would be a repeated definition each time the header file is included). Same with function prototypes:int printf(fmt, ...);
is valid inside of main. Inline function definitions being forbidden seems correct, yes, those cannot be nested in
main
.It is, in any case, bad practise to have the header includes in main, even if it may have been allowable at one point in C’s history.
Would it be ok to apply this after the release unless there is urgent need to have this fixed right now?
-
There is one other “odd' uses of
AC_TRY_XXX
in Cactus (not failures like this one thoug inCCTK_CHECK_C_INLINE
we haveAC_TRY_COMPILE(, [} $ac_kw int foo() {], [cctk_cv_c_inline=$ac_kw; break])
which probably would be nicer if it did:
AC_TRY_COMPILE($ac_kw int foo(){return 0;}], [], [cctk_cv_c_inline=$ac_kw; break])
since it does not “trick” autoconf by closing the autoconf created
main
function with the leading}
. -
With #
#2722we need to test on all clusters anyway and might just as well include this as well. -
-
- changed status to resolved
Thank you for the patch.
- Log in to comment
The current code works for me (e.g. on the Delta Cluster at UIUC, and also on Summit). I get:
in
cctk_Config.h
for both. On my M1 based macOS testing system with Homebrew it does indeed fail:So, since we have just entered code freeze for the release in May, I would not want to touch anything in configure if possible. While the change looks harmless, and indeed:
is much nicer code (and closer to how the actual arguments to
TRY_LINK
are defined) thanI would rather not risk changing anything if only macOS system are affected. Since there are no macOS production clusters, any timing obtained on them is not really useful to guide decisions for code optimization anyway I would think.
I would be happy to include the change in master just after the release and backport if no issues are found with it after a while. Though note that also the change to PAPI that is reported in
was applied to master just after the last release, always broke on Linux and was never reported. So master seems to not be used very much anymore it seems.#2714Out of curiosity:
actually forbidden? Ie does the C standard require that the includes happen at file level? There is in principle nothing wrong with declare function prototypes in local scope, and an
#include
is just a textual replacement, so valid inside of a function.