[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ccp4bb]: Portland Group Fortran compilers - the 99% solution

***  For details on how to be removed from this list visit the  ***
***    CCP4 home page http://www.dl.ac.uk/CCP/CCP4/main.html    ***


Several people have asked about using the Portland Group pgf77
compiler to build the CCP4 package.  I happen to be in the process
of configuring a new workstation, so this time I kept more complete 
notes on what I did, which I summarize here.

	1) This machine is running Mandrake 8.0(beta2) with the 2.4.2
	   kernel.  Some oddities in the end result may be due to bugs
	   in the distribution support libraries or even the kernel, 
	   not the pgf77+CCP4 combination.
	2) As you will see, there is some remaining funny stuff having
	   to do with file handling. After a bit of poking around, I
	   discovered this is an ugly can of worms involving M4 (which
	   I don't grok), lib/src/library.c, lib/src/unix.m4, 
	   lib/src/unix.dir/ccpdpn.f, and possibly the libhtml routines.
	   I hope the info I give at the end is sufficient for someone
	   more familiar than I am with arcane details of CCP4
	   file handling to suggest appropriate modifications to unix.m4
	3) I haven't given this particular installation a lot of testing, 
	   since I just built it over the weekend.  But I've had only a
	   few problems using pgf77+CCP4 on my older linux boxes.

OK, here we go.

	I distrust the use of environment variables LD_LIBARY_PATH and
	MAN_PATH, because I've had trouble with them in the past. 
	I commented out both, and instead added the full path name of
	the CCP4 man directory to /etc/man.config, and the full path
	name of the CCP4 lib directory to /etc/ld.so.config
	Later on (after installing the libraries) you will need to run


	I added a configuration option for linux_pgf77.  What I actually
	did was to replace the linux_compaq_compilers keyword sections 
	with a linux_pgf77 keyword instead.  The important definitions 
	The key portion of this change is as follows:

# Added by Ethan Merritt March 2001
    echo "! This is a new option and is relatively untested!"
    echo "! March 2001"
  case `uname -sr` in

       echo "! This doesn't appear to be a Linux system. You should run"
       echo "! configure on a machine of the correct type."
       exit 1 ;;
  case `which pgf77` in

       echo "! You don't appear to have the Portland Group compiler (pgf77). "
       echo "! Either fix that first, or use ./configure linux to compile with g77. "
       exit 1 ;;
  M4=${M4-"m4 -D_pgf77=1"}
  SETFLAGS=${SETFLAGS-"amore_FLAGS='-O' rsps_FLAGS='-O' \
                   sftools_FLAGS='$XFFLAGS $FOPTIM' \
               arp_warp_FLAGS='$XFFLAGS $FOPTIM -C -static' \
               mosflm_FFLAGS='$XFFLAGS $FOPTIM -w' \
               mosflm_LDFLAGS='-s' \
               filec_CFLAGS='$XCFLAGS $FOPTIM -Dlinux' "}
  XDL_LIB=${XDL_LIB-"-L${CCP4_LIB} -lxdl_view"}
  XWIN_LIB=${XWIN_LIB-"-L/usr/X11R6/lib -lXt -lSM -lX11 -lICE"}
  TIDY=${TIDY-"rm -f sta*"}
  if test "$shared_lib" = yes; then
    SHARE_LIB=${SHARE_LIB-'ld -shared -soname libccp4.so --whole-archive -o libccp4.so libccp4.a'}
    SHARE_INST='$(INSTALL_DATA) `pwd`/libccp4.so $(libdir)/libccp4.so'

	The platform-specific configuration stuff for file handling is 
	controlled here, so far as I can work out.  Unfortunately, I do not
	speak M4, so I was reluctant to experiment very much with 
	modifying this file.  I added two lines to lib/src/unix.m4 in an
	attempt to force the use of the READONLY option in Fortran open
	statements.  As you will see, this may or may not have worked.
	Anyhow, the lines were


 	added right before the equivalent pair of lines for sgi installations

Building and installing the package
	Having now modified ./configure and lib/src/unix.m4, I proceeded to
	build the package

	./configure --with-x --with-shared-lib linux_pgf77
	make >& make_log
	make install >& install_log

	Once the shared libraries are installed in $CCP4/lib, we need to 
	add them to the system ld.so database.  I had already added the
	directory to /etc/ld.so.conf, but the database cannot be updated
	until the libraries are actually there.  So now run


	I have been using pgf77+CCP4 on my older linux machines (Mandrake 7.1)
	for a while now, so I know that it basically works.  The major problem
	I've encountered has been that scratch files don't delete themselves
	as they are supposed to, which has the unfortunate effect of filling up
	the $CCP4_SCR directory with old scratch files.  I've had to install
	a cron job to clear it out every day, and even then I've had problems
	with running out of disk space if the system is heavily used.
	More on this later.

	To add a bit more testing, I ran the scripts in ./examples/unix/runnable
	run-all >& run-all.log

	Two failures were reported:  lsqkab and refmac5_tls

Residual problems
	So it's only a 99% solution to using pgf77. There are still some
	problems with file handling.  I'm pretty sure these are fixable,
	but I haven't worked out exactly where/what to add to unix.m4

	1) The lsqkab_exam failure is due to the program attempting to 
	open the same file twice:  HKLIN1 rnase.pdb HKLIN2 rnase.pdb
	I can understand why this would be illegal without the READONLY
	flag, but I _thought_ that I had correctly added READONLY support.
	So I don't understand why it's still failing.  Just as a side note,
	I don't understand how this example ever works on a system that 
	doesn't support READONLY.

	2) The problem with accumulation of scratch files is because
	the DISPOSE=DELETE file handling option is not configured for
	pgf77 in unix.m4.   However, when I tried to add this based on
	similar lines already in the file for other platforms I ended
	up with really strange errors from the libhtml routines at
	runtime.  The error messages seemed to indicate that the code was
	trying to delete STDOUT (alias LPT), which of course is not a
	good idea.   But I couldn't find any actual cases of that in the
	code, so I'm not really sure what's going on.  I settled for
	installing without the DISPOSE=DELETE support and hoping my cron
	job can delete scratch files faster than they accumulate.

	3) The refmac_tls_exam error is another file open failure.
	It occurs at the very end, after the program has basically 
	finished refining.

	  Last system error message:
	  No such file or directory
	  Refmac_5.0.36:   Open failed: File: /home/tmp/merritt/test-results/refmac5_temp.14022_BOND_R

	This file actually does exist, so I'm guessing that here we have
	another case of a file being opened twice by the program without
	proper READONLY protection.

	4) Not so much a problem, just a comment.  For some reason code
	in the xdl_view directory gets built using the g77 compiler even 
	though ./configure should no longer mention g77 at all when 
	constructing Makefiles.  I don't think this hurts anything on my 
	system, but if you didn't have a working g77 compiler....

Fairly painless, especially on this new (fast!) machine.
Compile+install time about 10 minutes.
If someone can suggest how to correct the file opening options, 
I'd be happy to try it out and report back.

				happy computing!

					Ethan A Merritt