[gmx-users] compiling gromacs on powerpc64

Martin Siegert siegert at sfu.ca
Fri Aug 5 19:01:55 CEST 2005


On Thu, Aug 04, 2005 at 11:25:17PM +0200, David wrote:
> On Thu, 2005-08-04 at 12:29 -0700, Martin Siegert wrote:

> > Do you know which piece of the code actually writes these variables at the
> > beginning of topol.tpr?
> > 
> > write_tpx_state calls either write_xml or do_tpx. I quickly get lost in the
> > write_xml code. do_tpx calls do_string(GromacsVersion()); and then
> > do_int(precision); thus the problem ought to be visible already within
> > these two routines.
> > do_string is equivalent to
> > do_write((void *)(item),1,eioSTRING,(#item),__FILE__,__LINE__))
> > The actual routine seems to be determined in fio_select(int fio)
> > where it is set to (and here I get lost) do_xdr or do_binwrite.
> > If this actually is do_binwrite then this would first write an integer
> > namely the size of the string, in this case 14 = 0E. In this correct??
> 
> It is actually do_xdr for a tpr file. In tpxio.c, 1098 after writing out
> the version string it writes out an integer which is either 4 or 8 and
> which holds the precision. It could be a problem in the xdr libraries on
> the IBM. I assume that all compilers use the same libraries. The crux
> with using these libraries is that the data should be system-indepedent
> (and usually is)... Talk to your IBM support people.

Thanks! That nails it: xdr_int is not working in 64 bit mode.

    i = atoi(argv[1]);
    fn = (char *) malloc(strlen(OUTFILE) + 1);
    strncpy(fn, OUTFILE, strlen(OUTFILE));
    fp = fopen(fn, "wb+");
    xdr = (XDR *) malloc((size_t)sizeof(XDR));
    xdrstdio_create(xdr, fp, XDR_ENCODE);

    if (xdr_int(xdr, &i) <= 0) {
       fprintf(stderr, "error: failed to write integer %i to file %s\n",
                       i, fn);
       exit(-1);
    }

    xdr_destroy(xdr);
    fclose(fp);

Regardless of the value entered the output file always contains 0.
This appears to be a bug in glibc ...
I notified IBM.

Thanks for your patience!

Cheers,
Martin



More information about the gromacs.org_gmx-users mailing list