[gmx-developers] Adding computing kernels in shared linked library

Sebastian Jodłowski jodelek at icm.edu.pl
Wed Aug 24 16:52:50 CEST 2011


I'm trying to add some features (e.g. interactions with membrane) into
nb_generic_kernel. I've written all my stuff, tested it hardly and
everything seems to work perfectly - all results are correct. Next
step, which I would like to performe, is to extract my kernels and
move them to the external library. So I added my lib(for now empty
lib) to gromacs makefiles(all of them), and inlcuded my lib header in
the nb_generic.c. In that place gromacs compiled and linked properly.
I cut my kernel code from the nb_generic_kernel() body and above it I
created function my_kernel() which consist body of my kernel. All
parametres are passed via pointers and kernel is called in its earlier
body's place in nb_generic_kernel(). Then I tested it again -
everything works great. So I finally moved my_kernel into the library.
Gromacs compiled and linked properly so I started testing. The results
are already wrong at the stage of minimization. I performed 100 steps
of minimization and version without external library calls 78144 times
my_kernel wherease with external library my_kernel is called 69696.
(What the hell?)The results start to differ at about 60% (45000th
calls of my_kernel). I have no idead what's going on and I spent
several days looking for the bug and couldn't find it. I would like to
notice that i don't know how gromacs minimization works and have no to
time for studing these code(but I pretty good analised how computing
of forces works).
Has anybody ever met something similar? Or has any experience with
writing libraries for gromacs?
Greetings
Sebastian Jodlowski



More information about the gromacs.org_gmx-developers mailing list