[ET Trac] [Einstein Toolkit] #1958: parfiles accept 1.0, 0.0, 1e3 for integer typed parameters

Einstein Toolkit trac-noreply at einsteintoolkit.org
Wed Oct 19 14:15:29 CDT 2016


#1958: parfiles accept 1.0, 0.0, 1e3 for integer typed parameters
-----------------------+----------------------------------------------------
  Reporter:  rhaas     |       Owner:                     
      Type:  defect    |      Status:  new                
  Priority:  optional  |   Milestone:  ET_2016_11         
 Component:  Cactus    |     Version:  development version
Resolution:            |    Keywords:                     
-----------------------+----------------------------------------------------

Comment (by rhaas):

 I tested the patch with the attached parfile and it fails with:
 {{{
 Activating thorn TestPar...Success -> active implementation TestPar
 WARNING level 0 from host 8992d193.ncsa.illinois.edu process 0
   while executing schedule bin (none), routine (no thorn)::(no routine)
   in thorn TestPar, file int.par:7:
   -> Invalid assignment: Attempting to set a variable of type INT with
 (REAL)10
 }}}
 due to
 {{{
 TestPar::int2[2] = 20*0.5
 }}}

 Commenting out line 7 I get:
 {{{
 WARNING level 0 from host 8992d193.ncsa.illinois.edu process 0
   while executing schedule bin (none), routine (no thorn)::(no routine)
   in thorn TestPar, file int.par:8:
   -> Invalid assignment: Attempting to set a variable of type INT with
 (REAL)10
 }}}
 due to
 {{{
 TestPar::int2[3] = 20/2.
 }}}


 Commenting out line 8 I get
 {{{
 WARNING level 0 from host 8992d193.ncsa.illinois.edu process 0
   while executing schedule bin (none), routine (no thorn)::(no routine)
   in thorn TestPar, file int.par:10:
   -> Invalid assignment: Attempting to set a variable of type INT with
 (REAL)20
 }}
 from
 {{{
 TestPar::int2[5] = 20.
 }}}
 which is ok but I think should output the exact string from the parfile
 and not the real value.

 On the other hand it accepted
 {{{
 TestPar::int2[4] = 15/2
 }}}
 which it should not.

 Finally commenting out line 10 I get no error yet looking at the output
 file there is:
 {{{
 real2[0] = 0
 }}}
 which is clearly wrong since it was set to trunc(1e300). This fails due to
 casting the result of trunc/ceil etc to int since int cannot hold all the
 integer values that a double can. Note that if we ever switch to 64 bit
 CCTK_INT (there have been proposals for that) then using CCTK_REAL to hold
 CCTK_INT is no longer feasible since the mantissa of a double is not wide
 enough to exactly represent all 64 bit integers.

 The patched version also has the strange effect that:
 {{{
 TestPar::int2[1] = 20/2
 }}}
 is allowed but
 {{{
 TestPar::int2[2] = 20*0.5
 TestPar::int2[3] = 20/2.
 }}}
 are forbidden.

 Note that it also does abort after the first error found rather than
 reporting all errors and then aborting.

-- 
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1958#comment:18>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit


More information about the Trac mailing list