Skip to content

Commit

Permalink
small updates to nls, sls and hsl_mc68
Browse files Browse the repository at this point in the history
  • Loading branch information
dalekopera authored and amontoison committed Jun 5, 2024
1 parent 81fe43c commit 603b07e
Show file tree
Hide file tree
Showing 13 changed files with 169 additions and 80 deletions.
9 changes: 9 additions & 0 deletions bin/gal
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,15 @@ elif [[ $2 == 'colt' ]]; then
[[ $UPDATE == '1' ]] && $GALOBJ/buildspec colt update
[[ ! -L RUNCOLT.SPC ]] && ln -s ~/.galahad/specs/RUNCOLT.SPC RUNCOLT.SPC

# epf

elif [[ $2 == 'epf' ]]; then
RUNMAIN=$GALOBJ/runepf_sif_$PRECIS.o
# PROBLIB="-lgalahad_problem"
[[ ! -e ~/.galahad/specs/RUNEPF.SPC ]] && $GALOBJ/buildspec epf
[[ $UPDATE == '1' ]] && $GALOBJ/buildspec epf update
[[ ! -L RUNEPF.SPC ]] && ln -s ~/.galahad/specs/RUNEPF.SPC RUNEPF.SPC

# funnel

elif [[ $2 == 'funnel' ]]; then
Expand Down
148 changes: 93 additions & 55 deletions doc/README.matlab
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,93 @@ Matlab interfaces are now available to a growing number of GALAHAD packages
---------
For LINUX
---------
............................
MATLAB for R2022a and later
............................

For MATLAB R2011a and above, GALAHAD must be installed using the
gfortran compiler. BUT ... you will need to use (and have installed)
gcc/gfortran-10, not the more modern version (11 and above) that may
comes as default with today's Linux. For Ubuntu Linux, see

https://help.ubuntu.com/community/MATLAB

for details on how to download packaged versions of the relevant
outdated compilers. For other Linux distributions, you might have
to build gcc-10 from source code. Grumble to the Mathworks!

Once you have a working gcc/gfortran-10 - making sure that they are
both on your shell search path - either select the "install with Matlab"
option when installing, or if a gfortran version has already been installed,
issue the commands

cd $GALAHAD/src/matlab
make -s -f $GALAHAD/makefiles/pc64.lnx.gfo

(substitute pc.lnx.gfo for the appropriate string on non-Linux or 32-bit
machines, e.g pc.lnx.gfo).

N.B. the MATLAB environment variable must point to your system matlab directory.

Once the Matlab versions have been installed, make sure that
$GALAHAD/src/matlab is on your Matlab path.

Issue the commands

help galahad

within Matlab to find the current status of available interfaces.

Note that at present there is no single-precision version.

........................
MATLAB for R2020b-2021b
........................

As for MATLAB for R2022a, but you will need gfortran/gcc-8 not 10.
Edit $GALAHAD/makefiles/pc64.lnx.gfo to check that all mentions of gfortran/gcc
have the trailing -8. This should have been taken care of automatically
during the installation process.

.........................
MATLAB for R2018a-R2020a
.........................

As for MATLAB for R2022a, but you will need gfortran/gcc-6 not 10.
Edit $GALAHAD/makefiles/pc64.lnx.gfo to check that all mentions of gfortran/gcc
have the trailing -6. This should have been taken care of automatically
during the installation process.

........................
MATLAB for R2016b-R2017b
.........................

As for MATLAB for R2022a, but you will need gfortran/gcc-4.9 not 10
Edit $GALAHAD/makefiles/pc64.lnx.gfo to check that all mentions of gfortran/gcc
have the trailing -4.9. This should have been taken care of automatically
during the installation process.

........................
MATLAB for R2013b-R2016a
.........................

As for MATLAB for R2022a, but you will need gfortran/gcc-4.7 not 10.
Edit $GALAHAD/makefiles/pc64.lnx.gfo to check that all mentions of gfortran/gcc
have the trailing -4.7. This should have been taken care of automatically

........................
MATLAB for R2011a-R2013a
.........................
As for MATLAB for R2022a, but you will need gfortran/gcc-4.4 not 10.
Edit $GALAHAD/makefiles/pc64.lnx.gfo to check that all mentions of gfortran/gcc
have the trailing -4.4.

....................
MATLAB before R2011a
....................

To use the Matlab interfaces, GALAHAD must be installed using the
g95 compiler - other compilers may become available in the future
g95 compiler - other compilers have become available since then.
if Matlab's mex facility becomes more fortran-90 friendly. Either
select the "install with Matlab" option when installing, or if
a g95 version has already been installed, issue the commands
Expand Down Expand Up @@ -40,15 +120,6 @@ $GALAHAD/makefiles/pc64.lnx.g95, and to the FFLAGS variable in your Matlab
mexopts.sh file (in the relevant release subdirectory of the .matlab directory
in your home directory).

........................
MATLAB for R2011a-R2013a
.........................

For MATLAB R2011a and above, GALAHAD must be installed using the
gfortran compiler. BUT ... you will need to use (and have installed)
gcc/gfortran-4.4, not the more modern version (4.5 and above) that comes
as default with today's Linux. For Ubuntu Linux, see

https://help.ubuntu.com/community/MATLAB

for details on how to download packaged versions of the relevant
Expand Down Expand Up @@ -77,43 +148,6 @@ $GALAHAD/src/matlab is on your Matlab path.

to find the current status of available interfaces.

........................
MATLAB for R2013b-R2016a
.........................

As for MATLAB for R2011a-R2013a, but you will need gfortran/gcc-4.7 not 4.4.
Edit $GALAHAD/makefiles/pc64.lnx.gfo to check that all mentions of gfortran/gcc
have the trailing -4.7.

........................
MATLAB for R2016b-R2017b
.........................

As for MATLAB for R2011a-R2013a, but you will need gfortran/gcc-4.9 not 4.4.
Edit $GALAHAD/makefiles/pc64.lnx.gfo to check that all mentions of gfortran/gcc
have the trailing -4.9. This should have been taken care of automatically
during the installation process.

.........................
MATLAB for R2018a-R2020a
.........................

As for MATLAB for R2011a-R2013a, but you will need gfortran/gcc-6 not 4.4.
Edit $GALAHAD/makefiles/pc64.lnx.gfo to check that all mentions of gfortran/gcc
have the trailing -6. This should have been taken care of automatically
during the installation process.

............................
MATLAB for R2020b and above
............................

As for MATLAB for R2011a-R2013a, but you will need gfortran/gcc-8 not 4.4.
Edit $GALAHAD/makefiles/pc64.lnx.gfo to check that all mentions of gfortran/gcc
have the trailing -8. This should have been taken care of automatically
during the installation process.

Note that at present there is no single-precision version.

...........................
Replacement BLAS and LAPACK
...........................
Expand All @@ -137,7 +171,7 @@ than the dynamic -l* syntax.
For MAC OS X
------------

Here, the supported compiler is GNU gfortran. So
Here, the supported compiler used to be GNU gfortran. So

cd $GALAHAD/src/matlab
make -s -f $GALAHAD/makefiles/pc.lnx.gfo
Expand All @@ -164,16 +198,18 @@ interface.
The dreaded "MATLAB Error: Cannot load any more object with static TLS" bug
---------------------------------------------------------------------------

For a number of years, the Mathworks have been aware of a serious mex bug.
MATLAB dynamically loads some libraries with static TLS (thread local storage,
For a number of years, the Mathworks were aware of a serious mex bug.
MATLAB dynamically loaded some libraries with static TLS (thread local storage,
e.g. see gcc compiler flag -ftls-model). Loading too many such libs eventually
leaaves no space left. The Mathworks solution is a farcical work-around
leaaves no space left. The Mathworks solution was a farcical work-around
that involves inserting the line "ones(10)*ones(10);" in startup.m, that
aims to load "important" libraries first. Of late, this "solution" seems
increasigly less likley to work, but Mathworks appears not to care about
its significant mex user base by failing to provide a proper fix.
increasigly less likley to work, but Mathworks appeared not to care about
its significant mex user base by failing to provide a proper fix. Fortunately
sanity has broken out, and you are only likely to see this with older
versions of Matlab.

The most successful temporary "cure" we have found is to compile the
The most successful temporary "cure" we found was to compile the
Matlab programs as usual, to issue the command

ldd $GALAHAD/src/matlab/galahad_wcp.mexa64
Expand Down Expand Up @@ -221,6 +257,8 @@ for the discussion and tip
Nick Gould ([email protected])
Dominique Orban ([email protected])
Philippe Toint ([email protected])
Jari Fowkes ([email protected])
Alexis Montoison ([email protected])

For GALAHAD productions
This version: 12th November 2020
This version: 24th May 2024
5 changes: 3 additions & 2 deletions doc/src/makedocs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/csh

foreach pack ( arc bgo blls bllsb bqp bqpb bsc check clls cro ccqp cqp dgo dps dqp eqp fdc fdh filtrane fisqp glrt gls gltr hash icfs ir lancelot lancelot_simple lpa lpb lsp lsqp l2rt lsrt lstr llsr llst lms miqr mop nls nlpt presolve psls qpa qpb qpc qpp qpt rand roots rpd rqs sbls scale scu sha sils sls slls smt sort symbols trb trs tru ugo uls wcp )
#foreach pack ( arc bgo blls bllsb bqp bqpb bsc check clls cro ccqp cqp dgo dps dqp eqp fdc fdh filtrane fisqp glrt gls gltr hash icfs ir lancelot lancelot_simple lpa lpb lsp lsqp l2rt lsrt lstr llsr llst lms miqr mop nls nlpt presolve psls qpa qpb qpc qpp qpt rand roots rpd rqs sbls scale scu sha sils sls slls smt sort symbols trb trs tru ugo uls wcp )
#foreach pack ( filtrane )
#foreach pack ( sils )
#foreach pack ( sort )
Expand Down Expand Up @@ -36,7 +36,7 @@ foreach pack ( arc bgo blls bllsb bqp bqpb bsc check clls cro ccqp cqp dgo dps d
#foreach pack ( ir )
#foreach pack ( qpp )
#foreach pack ( lsp )
#foreach pack ( sha )
foreach pack ( sha )
#foreach pack ( clls )
#foreach pack ( lsqp )
#foreach pack ( qpa )
Expand Down Expand Up @@ -104,4 +104,5 @@ foreach pack ( arc bgo blls bllsb bqp bqpb bsc check clls cro ccqp cqp dgo dps d
# lpr ../$pack.ps
ps2pdf "-sPAPERSIZE=a4" ../$pack.ps ../$pack.pdf
rm ../$pack.ps
cp ../$pack.pdf ../../../galahad_docs/pdf/Fortran/
end
4 changes: 4 additions & 0 deletions include/galahad_modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
#define GALAHAD_LSQP_precision GALAHAD_LSQP_single_64
#define GALAHAD_LSRT_precision GALAHAD_LSRT_single_64
#define GALAHAD_LSTR_precision GALAHAD_LSTR_single_64
#define GALAHAD_MAP_precision GALAHAD_MAP_single_64
#define GALAHAD_MIQR_precision GALAHAD_MIQR_single_64
#define GALAHAD_MOP_precision GALAHAD_MOP_single_64
#define GALAHAD_NLLSRT_precision GALAHAD_NLLSRT_single_64
Expand Down Expand Up @@ -470,6 +471,7 @@
#define GALAHAD_LSQP_precision GALAHAD_LSQP_single
#define GALAHAD_LSRT_precision GALAHAD_LSRT_single
#define GALAHAD_LSTR_precision GALAHAD_LSTR_single
#define GALAHAD_MAP_precision GALAHAD_MAP_single
#define GALAHAD_MIQR_precision GALAHAD_MIQR_single
#define GALAHAD_MOP_precision GALAHAD_MOP_single
#define GALAHAD_NLLSRT_precision GALAHAD_NLLSRT_single
Expand Down Expand Up @@ -847,6 +849,7 @@
#define GALAHAD_LSQP_precision GALAHAD_LSQP_double_64
#define GALAHAD_LSRT_precision GALAHAD_LSRT_double_64
#define GALAHAD_LSTR_precision GALAHAD_LSTR_double_64
#define GALAHAD_MAP_precision GALAHAD_MAP_double_64
#define GALAHAD_MIQR_precision GALAHAD_MIQR_double_64
#define GALAHAD_MOP_precision GALAHAD_MOP_double_64
#define GALAHAD_NLLSRT_precision GALAHAD_NLLSRT_double_64
Expand Down Expand Up @@ -1220,6 +1223,7 @@
#define GALAHAD_LSQP_precision GALAHAD_LSQP_double
#define GALAHAD_LSRT_precision GALAHAD_LSRT_double
#define GALAHAD_LSTR_precision GALAHAD_LSTR_double
#define GALAHAD_MAP_precision GALAHAD_MAP_double
#define GALAHAD_MIQR_precision GALAHAD_MIQR_double
#define GALAHAD_MOP_precision GALAHAD_MOP_double
#define GALAHAD_NLLSRT_precision GALAHAD_NLLSRT_double
Expand Down
2 changes: 1 addition & 1 deletion include/hsl_mc68.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct mc68_info {
ipc_ duplicate; /* holds number of duplicate entries */
ipc_ n_compressions; /* holds number of compressions in order */
ipc_ n_zero_eigs; /* holds the number of zero eigs from ma47 */
long l_workspace; /* holds length of workspace iw used in order */
int64_t l_workspace; /* holds length of workspace iw used in order */
ipc_ zb01_info; /* holds flag from zb01_expand1 call */
ipc_ n_dense_rows; /* holds number of dense rows from amdd */
};
Expand Down
2 changes: 2 additions & 0 deletions include/hsl_subset.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifdef INTEGER_64
#define hsl_metis galahad_metis_64
#define HSL_METIS galahad_metis_64
#else
#define hsl_metis galahad_metis
#define HSL_METIS galahad_metis
#endif

#ifdef INTEGER_64
Expand Down
43 changes: 28 additions & 15 deletions src/external/hsl/makemaster
Original file line number Diff line number Diff line change
Expand Up @@ -617,22 +617,35 @@ hsl_zd11_double_64: kinds $(LHD64)(hsl_zd11d_64.o)

# metis

#metis_silent: metis_$(PRECIS)
#metis: metis_$(PRECIS)
# @printf ' %-21s\n' "GALAHAD: metis ($(PRECIS) $(SUCC)"
#metis_single: metis_32
#metis_double: metis_32
#metis_single_64: metis_64
#metis_double_64: metis_64

#metis_32:
# ( cd ./metis ; $(MAKE) -f \
# $(GALAHAD)/makefiles/$(VERSION) build \
# PRECIS=$(PRECIS) PWD=$(PWD)/metis )
#metis_64:
# ( cd ./metis ; $(MAKE) -f \
# $(GALAHAD)/makefiles/$(VERSION) build_64 \
# PRECIS=$(PRECIS) PWD=$(PWD)/metis )

metis: metis_silent
@printf ' %-21s\n' "HSL METIS routines ($(PRECIS) $(SUCC)"
metis_silent: metis_$(PRECIS)
metis: metis_$(PRECIS)
@printf ' %-21s\n' "GALAHAD: metis ($(PRECIS) $(SUCC)"
metis_single: metis_32
metis_double: metis_32
metis_single_64: metis_64
metis_double_64: metis_64

metis_32:
( cd ./metis ; $(MAKE) -f \
$(GALAHAD)/makefiles/$(VERSION) build \
PRECIS=$(PRECIS) PWD=$(PWD)/metis )
metis_64:
( cd ./metis ; $(MAKE) -f \
$(GALAHAD)/makefiles/$(VERSION) build_64 \
PRECIS=$(PRECIS) PWD=$(PWD)/metis )
metis_single: kinds $(LHS)(hsl_metis.o) $(LHS)(hsl_metis5_adapter.o)
metis_double: kinds $(LHD)(hsl_metis.o) $(LHD)(hsl_metis5_adapter.o)
metis_single_64: kinds $(LHS64)(hsl_metis_64.o) \
$(LHS64)(hsl_metis5_adapter_64.o)
metis_double_64: kinds $(LHD64)(hsl_metis_64.o) \
$(LHD64)(hsl_metis5_adapter_64.o)
metis_nodend:
( cd ./metis ; \
$(MAKE) -f $(HSLSUBSET)/makefiles/$(VERSION) all PWD=$(PWD)/metis )

# hsl_metis

Expand Down
3 changes: 2 additions & 1 deletion src/llsr/llsr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3388,7 +3388,8 @@ SUBROUTINE LLSR_import_scaling( data, status, S_type, S_ne, S_row, &

! copy control to data

WRITE( data%llsr_control%out, "( '' )", ADVANCE = 'no') !prevents ifort bug
IF ( data%llsr_control%out > 0 ) WRITE( data%llsr_control%out, &
"( '' )", ADVANCE = 'no') !prevents ifort bug
error = data%llsr_control%error
space_critical = data%llsr_control%space_critical
deallocate_error_fatal = data%llsr_control%space_critical
Expand Down
20 changes: 20 additions & 0 deletions src/makedefs/intermediaries
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@ make_lstr:
$(MAKE) -f $(GALAHAD)/makefiles/$(VERSION) lstr.o \
PRECIS=$(PRECIS) PWD=$(GALAHAD)/src/lstr )

make_map:
( cd $(GALAHAD)/src/map ; \
$(MAKE) -f $(GALAHAD)/makefiles/$(VERSION) map.o \
PRECIS=$(PRECIS) PWD=$(GALAHAD)/src/map )

make_miqr:
( cd $(GALAHAD)/src/miqr ; \
$(MAKE) -f $(GALAHAD)/makefiles/$(VERSION) miqr.o \
Expand Down Expand Up @@ -992,6 +997,11 @@ make_all_lstr:
$(MAKE) -f $(GALAHAD)/makefiles/$(VERSION) lstr_silent \
PRECIS=$(PRECIS) PWD=$(GALAHAD)/src/lstr )

make_all_map:
( cd $(GALAHAD)/src/map ; \
$(MAKE) -f $(GALAHAD)/makefiles/$(VERSION) map_silent \
PRECIS=$(PRECIS) PWD=$(GALAHAD)/src/map )

make_all_miqr:
( cd $(GALAHAD)/src/miqr ; \
$(MAKE) -f $(GALAHAD)/makefiles/$(VERSION) miqr_silent \
Expand Down Expand Up @@ -1597,6 +1607,11 @@ make_ciface_lstr:
$(MAKE) -f $(GALAHAD)/makefiles/$(VERSION) lstr_ciface.o \
PRECIS=$(PRECIS) PWD=$(GALAHAD)/src/lstr )

make_ciface_map:
( cd $(GALAHAD)/src/map ; \
$(MAKE) -f $(GALAHAD)/makefiles/$(VERSION) map_ciface.o \
PRECIS=$(PRECIS) PWD=$(GALAHAD)/src/map )

make_ciface_miqr:
( cd $(GALAHAD)/src/miqr ; \
$(MAKE) -f $(GALAHAD)/makefiles/$(VERSION) miqr_ciface.o \
Expand Down Expand Up @@ -2254,6 +2269,11 @@ make_pyiface_lstr:
$(MAKE) -f $(GALAHAD)/makefiles/$(VERSION) lstr_pyiface.o \
PRECIS=$(PRECIS) PWD=$(GALAHAD)/src/lstr )

make_pyiface_map:
( cd $(GALAHAD)/src/map ; \
$(MAKE) -f $(GALAHAD)/makefiles/$(VERSION) map_pyiface.o \
PRECIS=$(PRECIS) PWD=$(GALAHAD)/src/map )

make_pyiface_miqr:
( cd $(GALAHAD)/src/miqr ; \
$(MAKE) -f $(GALAHAD)/makefiles/$(VERSION) miqr_pyiface.o \
Expand Down
Loading

0 comments on commit 603b07e

Please sign in to comment.