AMBER Archive (2007)

Subject: RE: AMBER: Problems with QMMM tests on Altix

From: Ross Walker (ross_at_rosswalker.co.uk)
Date: Sat Feb 24 2007 - 12:02:24 CST


Hi All,

Thanks to Jarrod for giving me a login to his Altix.

Okay this is definately a compiler bug on the part of Intel. Here is the
effected code. The file is qm_link_atoms.f and I have inserted a few write
statements to output the value of nlink:

  qmmm_struct%nlink=0
  do i=1,nbona
      ii = .false.
      jj = .false.
      do j=1,qmmm_struct%nquant
         ii=ii .or. ((ib(i)/3 + 1).eq.qmmm_nml%iqmatoms(j))
         jj=jj .or. ((jb(i)/3 + 1).eq.qmmm_nml%iqmatoms(j))
      end do
      if (ii .neqv. jj) then

write(6,*) "passed test nlink before=",qmmm_struct%nlink

         qmmm_struct%nlink=qmmm_struct%nlink+1

write(6,*) "passed test nlink after=",qmmm_struct%nlink

      end if
  end do
write(6,*) "link atoms 3 nlink=",qmmm_struct%nlink

With ifort 8.1 this gives as expected:

 passed test nlink before= 0
 passed test nlink after= 1
 passed test nlink before= 1
 passed test nlink after= 2
 passed test nlink before= 2
 passed test nlink after= 3
 passed test nlink before= 3
 passed test nlink after= 4
 passed test nlink before= 4
 passed test nlink after= 5
 passed test nlink before= 5
 passed test nlink after= 6
 passed test nlink before= 6
 passed test nlink after= 7
 passed test nlink before= 7
 passed test nlink after= 8
 link atoms 3 nlink= 8

But with ifort 9.1.040 on Altix this gives:

 passed test nlink before= 0
 passed test nlink after= 1
 passed test nlink before= 1
 passed test nlink after= 2
 passed test nlink before= 2
 passed test nlink after= 3
 passed test nlink before= 3
 passed test nlink after= 4
 passed test nlink before= 3
 passed test nlink after= 4
 passed test nlink before= 3
 passed test nlink after= 4
 passed test nlink before= 3
 passed test nlink after= 4
 passed test nlink before= 3
 passed test nlink after= 4
 link atoms 3 nlink= 3

So after 4 iterations of the loop nlink gets hoplessly corrupted.

It looks like this is related to misoptimization of this file by the Intel
compiler. The following temporary workaround should work:

Edit $AMBERHOME/src/sander/depend

change (line 2566)

qm_link_atoms.o: qm_link_atoms.f
        $(FPP) qm_link_atoms.f > _qm_link_atoms.f
        $(FC) -c $(FOPTFLAGS) -o $@ _qm_link_atoms.f

to

qm_link_atoms.o: qm_link_atoms.f
        $(FPP) qm_link_atoms.f > _qm_link_atoms.f
        $(FC) -c $(FOPTFLAGS) -O2 -o $@ _qm_link_atoms.f

then cd $AMBERHOME/src/
make clean
make
cd ../test/
make

And this time it will hopefully work. Hopefully Intel will fix this in later
versions of their compiler so for the moment I won't try to put a formal
bugfix together for this as it could be tricky to work around this bug.

Let me know if you have any further problems.

All the best
Ross

/\
\/
|\oss Walker

| HPC Consultant and Staff Scientist |
| San Diego Supercomputer Center |
| Tel: +1 858 822 0854 | EMail:- ross_at_rosswalker.co.uk |
| http://www.rosswalker.co.uk | PGP Key available on request |

Note: Electronic Mail is not secure, has no guarantee of delivery, may not
be read every day, and should not be used for urgent or sensitive issues.

-----------------------------------------------------------------------
The AMBER Mail Reflector
To post, send mail to amber_at_scripps.edu
To unsubscribe, send "unsubscribe amber" to majordomo_at_scripps.edu