Again: maximum number of events
Kim Lefmann
kim.lefmann at risoe.dk
Tue Mar 6 09:39:44 CET 2001
------------------------------
From: Kristian Nielsen <kristian at edlund.dk>
Subject: Re: Again: maximum number of events...
In-reply-to: "Ulrich C. Wildgruber MPI fuer Metallforschung Stuttgart"'s
message of "Mon, 05 Mar 2001 14:06:27 +0100"
To: neutron-mc at risoe.dk
Message-id: <uofvfmj8k.fsf at edlund.dk>
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7
Lines: 42
References: <3AA34FFE.E3B2B252 at dxray.mpi-stuttgart.mpg.de>
<3AA36A49.282C40B at phys.keele.ac.uk>
<3AA38F53.22411C9 at dxray.mpi-stuttgart.mpg.de>
"Ulrich C. Wildgruber MPI fuer Metallforschung Stuttgart" <wildgrub at dxray.mpi-stuttgart.mpg.de> writes:
> Maybe I misunderstood Kristian's email (I'll look for it and forward it to
> you) or there is something wrong with the way McStas is set up on my
> machine. The behaviour of McStas seems to be compatible with an "long int"
> counting variable being 32bits on a PC and 64 bits on the ALPHA...
> I guess I'll try to look into the code...
I decided to re-check the source code. The relevant code is in the file
"lib/mcstas-r.c" (some parts deleted for clarity):
/* Number of neutron histories to simulate. */
static double mcncount = 1e6;
/* McStas main() function. */
int
mcstas_main(int argc, char *argv[])
{
int run_num = 0;
^^^
while(run_num < mcncount)
{
mcsetstate(0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1);
mcraytrace();
run_num++;
}
return 0;
}
So "mcncount" is a double, as I said before, but the loop counter
"run_num" is an int. This is a bug, the declaration should be changed to
double run_num = 0;
Without this change, McStas is clearly limited to about 2*10**9
neutrons/run on 32 bit machines. I am mystified as to why this is not
the case on the Alpha (I thought that on Alpha, int was 32 bit and long
was 64, but maybe my memory deceives me).
- Kristian.
More information about the mcstas-users
mailing list