Conversation
|
I have thought about this a bit more especially in light of Blanco, W., Lopes, P. H., De S. Souza, A. A., & Mascagni, M. (2020). They showed that the But we might want to give the user a choice to force the old behavior with a compiler switch. I am just not sure about the name, maybe |
|
Nice finding HEP. I think if expm1 is in the standard we should normally use this, as you say. Still, also as you say, having the opportunity to reproduce our old results in special situations is of high value. So a compiler switch is a good option. I think with-classic-expm1 is the better choice because with-nest-expm1 suggests a bit that this is extra good. |
Good point, but I am not really happy with "classic" either—what does it really mean? Any other ideas? |
|
Explored some more: The differences between our handcrafted solution and |
|
I did some more experiments (with some help from duck.ai/Haiku 4.5) as follows:
Results show the following:
The difference between different compilers are thus of the same order as between the different implementations. All my data are obtained on Apple Silicon, Intel-ish CPUs with 80 bit floating point registers may add more variation in results for the same operations. Therefore, I think that it is justified to simply correct the detection mechanism in CMake without adding an extra switch. If someone really wants to test things, they can modify I will modernize the CMake mechanism a little because the function currently used there is deprecated. I will also switch from |
In many of our models, we use
expm1()to compute propagator elements. Sinceexpm1()historically was not guaranteed to be available inmath.horcmath, we let CMake check ifexpm1()was available inmath.hand if not, we provided our own implementation.It now turns out that this CMake mechanism was incorrectly implemented: The detection worked correctly, but
HAVE_EXPM1was never set inconfig.hdue to an extra argument to the pertaining CMake function that got things messed up. This PR fixes this, so thatHAVE_EXPM1is now properly set.One could wonder whether we need the check at all, given that according to CPPReference is part of the standard; but a Perplexity query gave a more ambiguous result.
Now the problem here is that this fix will change NEST results, because the
expm1()function from C++ may return different results from our implementation, which has been used in all NEST experiments over at least the past decade due to the bug described and fixed here.To test the consequences, I performed simulations with the
brunel_alpha_nest.pyexample and a modified version using the preciseiaf_psc_alpha_psneuron. For the normaliaf_psc_alphaneuron, I did not find a single spike differed when recording from 500 spikes for 10s. But for the precise neurons, already the time of the first spikes differed by about 10 eps with "macroscopic" differences in spike patterns later in the simulation. The precise neurons are a much harder test since they evaluateexpm1()essentially for every incoming spike and thus also probe a much wider range of argument values, especially values close to 0. The implementation frommath.h, btw, gives about 25% faster network simulation times for the ps-case.How do we proceed here?