Skip to content

Commit

Permalink
replace CUTEST_SINGLE/DOUBLE by SINGLE/DOUBLE throughout
Browse files Browse the repository at this point in the history
  • Loading branch information
dalekopera committed Feb 18, 2024
1 parent 00999c3 commit d78ea67
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 75 deletions.
2 changes: 1 addition & 1 deletion include/cg_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

/* added by nick gould to allow single (float) precision */

#ifdef CUTEST_SINGLE
#ifdef SINGLE
typedef float rp_;
#else
typedef double rp_;
Expand Down
6 changes: 3 additions & 3 deletions include/cutest.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Boolean logicals provided, August 21 2013
* fortran intent(in) variables defined as const, Dec 2 2015
*
* this version 2024-01-18
* this version 2024-02-18
*
* ======================================================================
*/
Expand Down Expand Up @@ -60,15 +60,15 @@ typedef double doublereal;
/* typedef _Bool logical; */
typedef bool logical;

#ifdef CUTEST_SINGLE
#ifdef SINGLE
typedef float rp_;
typedef float rpc_;
#else
typedef double rp_;
typedef double rpc_;
#endif

#ifdef CUTEST_64BIT_INTEGER
#ifdef INTEGER_64
typedef long long ip_;
typedef long long ipc_;
#else
Expand Down
18 changes: 9 additions & 9 deletions include/cutest_modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
*
* Nick Gould for CUTEst
* initial version, 2023-11-02
* this version 2024-01-18
* this version 2024-02-18
*/
#ifdef CUTEST_64BIT_INTEGER
#ifdef INTEGER_64
#define CUTEST_KINDS_integer CUTEST_KINDS_64
#else
#define CUTEST_KINDS_integer CUTEST_KINDS_int
#endif

#if defined CUTEST_HALF
#ifdef CUTEST_64BIT_INTEGER
#if defined HALF
#ifdef INTEGER_64
#define CUTEST_KINDS_precision CUTEST_KINDS_half_64
#define CUTEST_precision CUTEST_half_64
#define CUTEST_PROBLEM_precision CUTEST_PROBLEM_half_64
Expand All @@ -29,8 +29,8 @@
#define CUTEST_INTERFACE_precision CUTEST_INTERFACE_half
#define CUTEST_LQP_precision CUTEST_LQP_half
#endif
#elif defined CUTEST_SINGLE
#ifdef CUTEST_64BIT_INTEGER
#elif defined SINGLE
#ifdef INTEGER_64
#define CUTEST_KINDS_precision CUTEST_KINDS_single_64
#define CUTEST_precision CUTEST_single_64
#define CUTEST_PROBLEM_precision CUTEST_PROBLEM_single_64
Expand All @@ -43,8 +43,8 @@
#define CUTEST_INTERFACE_precision CUTEST_INTERFACE_single
#define CUTEST_LQP_precision CUTEST_LQP_single
#endif
#elif defined CUTEST_QUAD
#ifdef CUTEST_64BIT_INTEGER
#elif defined QUAD
#ifdef INTEGER_64
#define CUTEST_KINDS_precision CUTEST_KINDS_quadruple_64
#define CUTEST_precision CUTEST_quadruple_64
#define CUTEST_PROBLEM_precision CUTEST_PROBLEM_quadruple_64
Expand All @@ -58,7 +58,7 @@
#define CUTEST_LQP_precision CUTEST_LQP_quadruple
#endif
#else
#ifdef CUTEST_64BIT_INTEGER
#ifdef INTEGER_64
#define CUTEST_KINDS_precision CUTEST_KINDS_double_64
#define CUTEST_precision CUTEST_double_64
#define CUTEST_PROBLEM_precision CUTEST_PROBLEM_double_64
Expand Down
4 changes: 2 additions & 2 deletions include/cutest_routines.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
* Nick Gould for CUTEst
* initial version, 2023-11-11
* this version 2023-11-11
* this version 2024-02-18
*/

#ifdef CUTEST_SINGLE
#ifdef SINGLE
#include "cutest_routines_single.h"
#else
#include "cutest_routines_double.h"
Expand Down
4 changes: 2 additions & 2 deletions src/cg_descent/cg_descent_main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* THIS VERSION: CUTEST 2.2 - 2023-12-02 AT 14:30 GMT */
/* THIS VERSION: CUTEST 2.3 - 2024-02-18 AT 09:00 GMT */

/* ====================================================
* CUTEst interface for cg_descent April. 5, 2014
Expand Down Expand Up @@ -203,7 +203,7 @@ rp_ cg_valgrad

spec = fopen ("CG_DESCENT.SPC", "r") ;

#ifdef CUTEST_SINGLE
#ifdef SINGLE
char pg[ ]="%g";
#else
char pg[ ]="%lg";
Expand Down
4 changes: 2 additions & 2 deletions src/derchk/derchk_main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* THIS VERSION: CUTEST 2.2 - 2023-12-02 AT 15:30 GMT */
/* THIS VERSION: CUTEST 2.3 - 2024-02-18 AT 09:10 GMT */

/* ===========================================
* CUTEst interface to derivative checker
Expand Down Expand Up @@ -72,7 +72,7 @@ extern "C" { /* To prevent C++ compilers from mangling symbols */
rp_ *cxp, *cxm, *g;
int nerr = 0;

#ifdef CUTEST_SINGLE
#ifdef SINGLE
h = 1.0e-4;
der_max = 1.0e-2;
#else
Expand Down
20 changes: 10 additions & 10 deletions src/gsl/gsl_main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* THIS VERSION: CUTEST 2.2 - 2023-12-05 AT 13:20 GMT */
/* THIS VERSION: CUTEST 2.3 - 2024-02-18 AT 09:10 GMT */

/* =================================================
* CUTEst interface for GNU Scientific Library (GSL)
Expand Down Expand Up @@ -49,15 +49,15 @@ struct param_data {
int n;
};

#ifdef CUTEST_SINGLE
#ifdef SINGLE
int eval_fn( const gsl_vector_float *x, void *params, gsl_vector_float *f ) {
#else
int eval_fn( const gsl_vector *x, void *params, gsl_vector *f ) {
#endif
struct param_data *data = (struct param_data*) params;
int status;
rp_ obj, i;
#ifdef CUTEST_SINGLE
#ifdef SINGLE
const rp_ *xptr = gsl_vector_float_const_ptr(x, 0);
rp_ *fptr = gsl_vector_float_ptr(f, 0);
#else
Expand All @@ -68,7 +68,7 @@ int eval_fn( const gsl_vector *x, void *params, gsl_vector *f ) {
return GSL_SUCCESS;
}

#ifdef CUTEST_SINGLE
#ifdef SINGLE
int eval_jacobian( const gsl_vector_float *x, void *params,
gsl_matrix_float *J ) {
#else
Expand All @@ -85,7 +85,7 @@ int eval_jacobian( const gsl_vector *x, void *params,
int status, ldJ;
grlagf = false;
jtrans = true; /* GSL uses row major */
#ifdef CUTEST_SINGLE
#ifdef SINGLE
xptr = gsl_vector_float_const_ptr(x, 0);
Jptr = gsl_matrix_float_ptr(J, 0, 0);
#else
Expand All @@ -99,7 +99,7 @@ int eval_jacobian( const gsl_vector *x, void *params,
return GSL_SUCCESS;
}

#ifdef CUTEST_SINGLE
#ifdef SINGLE
int eval_fn_jacobian( const gsl_vector_float *x, void *params,
gsl_vector_float *f, gsl_matrix_float *J ) {
#else
Expand All @@ -117,7 +117,7 @@ int eval_fn_jacobian( const gsl_vector *x, void *params,
rp_ obj;
grlagf = false;
jtrans = true; /* GSL uses row major */
#ifdef CUTEST_SINGLE
#ifdef SINGLE
xptr = gsl_vector_float_const_ptr(x, 0);
Jptr = gsl_matrix_float_ptr(J, 0, 0);
fptr = gsl_vector_float_ptr(f, 0);
Expand Down Expand Up @@ -168,7 +168,7 @@ int MAINENTRY( void ){
rp_ epsabs, epsrel;
struct param_data params;

#ifdef CUTEST_SINGLE
#ifdef SINGLE
gsl_vector_float_view xview;
#else
gsl_vector_view xview;
Expand Down Expand Up @@ -337,7 +337,7 @@ int MAINENTRY( void ){
fdf.p = CUTEst_nvar;
fdf.params = &params;
/* Set up optimizer with function and initial guess */
#ifdef CUTEST_SINGLE
#ifdef SINGLE
xview = gsl_vector_float_view_array(x, CUTEst_nvar);
#else
xview = gsl_vector_view_array(x, CUTEst_nvar);
Expand All @@ -358,7 +358,7 @@ int MAINENTRY( void ){
}
rewind( indr );

#ifdef CUTEST_SINGLE
#ifdef SINGLE
char pf[ ]="%f%*[^\n]\n";
#else
char pf[ ]="%lf%*[^\n]\n";
Expand Down
28 changes: 12 additions & 16 deletions src/makedefs/definitions
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
# Standard CUTEst makefile definitions

# Nick Gould, for GALAHAD production
# This version: 2024-01-18
# This version: 2024-02-03

# makefile shell

SHELL = /bin/$(BINSHELL)

ifeq "$(PRECIS)" "single"
ifeq "$(INTEGER)" "64bit"
DPREC = -DCUTEST_SINGLE -DCUTEST_64BIT_INTEGER
HSL_PRECIS = s
else
DPREC = -DCUTEST_SINGLE
HSL_PRECIS = s
endif
ifeq "$(PRECIS)" "single_64"
DPREC = -DSINGLE -DINTEGER_64
HSL_PRECIS = s64
else ifeq "$(PRECIS)" "double_64"
DPREC = -DDOUBLE -DINTEGER_64
HSL_PRECIS = d64
else ifeq "$(PRECIS)" "single"
DPREC = -DSINGLE
HSL_PRECIS = s
else
ifeq "$(INTEGER)" "64bit"
DPREC = -DCUTEST_DOUBLE -DCUTEST_64BIT_INTEGER
HSL_PRECIS = d
else
DPREC = -DCUTEST_DOUBLE
HSL_PRECIS = d
endif
DPREC = -DDOUBLE
HSL_PRECIS = d
endif

# compiler flags
Expand Down
4 changes: 2 additions & 2 deletions src/nomad/nomad_main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* THIS VERSION: CUTEST 2.2 - 2023-12-05 AT 12:40 GMT */
/* THIS VERSION: CUTEST 2.3 - 2024-02-18 AT 09:10 GMT */

/* ====================================================
* CUTEst interface simulating a black box for NOMAD.
Expand Down Expand Up @@ -117,7 +117,7 @@ extern "C" { /* To prevent C++ compilers from mangling symbols */
return 0;
}

#ifdef CUTEST_SINGLE
#ifdef SINGLE
char pf[ ]="%f";
#else
char pf[ ]="%lf";
Expand Down
4 changes: 2 additions & 2 deletions src/osqp/osqp_main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* THIS VERSION: CUTEST 2.2 - 2023-12-05 AT 08:20 GMT */
/* THIS VERSION: CUTEST 2.3 - 2024-02-18 AT 08:50 GMT */

/* ===========================================
* CUTEst interface to OSQP
Expand Down Expand Up @@ -485,7 +485,7 @@ int MAINENTRY(void) {
$OSQP/include/types.h for the parameter names and descriptions and
$OSQP/include/constants.h for default values */

#ifdef CUTEST_SINGLE
#ifdef SINGLE
char pg[ ]="%g";
#else
char pg[ ]="%lg";
Expand Down
4 changes: 2 additions & 2 deletions src/ral_nlls/ral_nlls_main.F90
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
! THIS VERSION: CUTEST 2.2 - 2023-11-16 AT 15:20 GMT.
! THIS VERSION: CUTEST 2.3 - 2024-02-18 AT 09:20 GMT.

#include "cutest_modules.h"
#include "cutest_routines.h"
#ifdef CUTEST_SINGLE
#ifdef SINGLE
#define RAL_NLLS_precision RAL_NLLS_single
#else
#define RAL_NLLS_precision RAL_NLLS_double
Expand Down
4 changes: 2 additions & 2 deletions src/ral_nlls/ral_nlls_test.F90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! THIS VERSION: CUTEST 2.2 - 2023-11-16 AT 16:00 GMT.
! THIS VERSION: CUTEST 2.3 - 2024-02-18 AT 09:00 GMT.

#include "cutest_modules.h"
#ifdef CUTEST_SINGLE
#ifdef SINGLE
#define RAL_NLLS_precision RAL_NLLS_single
#else
#define RAL_NLLS_precision RAL_NLLS_double
Expand Down
9 changes: 3 additions & 6 deletions src/test/makemaster
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,13 @@ run_debug_cutest_constrained: ctools test_cutest_constrained

tools:
( cd ../tools ; $(MAKE) -f $(CUTEST)/makefiles/$(VERSION) \
cutest PRECIS=$(PRECIS) INTEGER=$(INTEGER) \
PWD=$(PWD)/../tools )
cutest PRECIS=$(PRECIS) PWD=$(PWD)/../tools )
utools:
( cd ../tools ; $(MAKE) -f $(CUTEST)/makefiles/$(VERSION) \
cutest_unconstrained PRECIS=$(PRECIS) INTEGER=$(INTEGER) \
PWD=$(PWD)/../tools )
cutest_unconstrained PRECIS=$(PRECIS) PWD=$(PWD)/../tools )
ctools:
( cd ../tools ; $(MAKE) -f $(CUTEST)/makefiles/$(VERSION) \
cutest_constrained PRECIS=$(PRECIS) INTEGER=$(INTEGER) \
PWD=$(PWD)/../tools )
cutest_constrained PRECIS=$(PRECIS) PWD=$(PWD)/../tools )

# individual compilations

Expand Down
22 changes: 11 additions & 11 deletions src/tools/creport.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! THIS VERSION: CUTEST 2.2 - 2023-11-12 AT 10:30 GMT.
! THIS VERSION: CUTEST 2.3 - 2024-02018 AT 09:15 GMT.

#include "cutest_modules.h"
#include "cutest_routines.h"
Expand Down Expand Up @@ -176,18 +176,18 @@ SUBROUTINE CUTEST_creport_threadsafe_r( data, work, status, CALLS, TIME )
TIME( 3 ) = data%su_time
TIME( 4 ) = time_now - data%st_time

CALLS( 1 ) = work%nc2of
CALLS( 2 ) = work%nc2og
CALLS( 3 ) = work%nc2oh
CALLS( 4 ) = work%nhvpr
CALLS( 1 ) = REAL( work%nc2of, rp_)
CALLS( 2 ) = REAL( work%nc2og, rp_)
CALLS( 3 ) = REAL( work%nc2oh, rp_)
CALLS( 4 ) = REAL( work%nhvpr, rp_)
IF( work%pnc > 0 ) THEN
CALLS( 5 ) = work%nc2cf / work%pnc
CALLS( 6 ) = work%nc2cg / work%pnc
CALLS( 7 ) = work%nc2ch / work%pnc
CALLS( 5 ) = REAL( work%nc2cf, rp_) / REAL( work%pnc, rp_)
CALLS( 6 ) = REAL( work%nc2cg, rp_) / REAL( work%pnc, rp_)
CALLS( 7 ) = REAL( work%nc2ch, rp_) / REAL( work%pnc, rp_)
ELSE
CALLS( 5 ) = work%nc2cf
CALLS( 6 ) = work%nc2cg
CALLS( 7 ) = work%nc2ch
CALLS( 5 ) = REAL( work%nc2cf, rp_)
CALLS( 6 ) = REAL( work%nc2cg, rp_)
CALLS( 7 ) = REAL( work%nc2ch, rp_)
ENDIF

status = 0
Expand Down
10 changes: 5 additions & 5 deletions src/tools/ureport.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! THIS VERSION: CUTEST 2.2 - 2023-11-12 AT 10:30 GMT.
! THIS VERSION: CUTEST 2.3 - 2024-02018 AT 09:15 GMT.

#include "cutest_modules.h"
#include "cutest_routines.h"
Expand Down Expand Up @@ -150,10 +150,10 @@ SUBROUTINE CUTEST_ureport_threadsafe_r( data, work, status, CALLS, TIME )
TIME( 3 ) = data%su_time
TIME( 4 ) = time_now - data%st_time

CALLS( 1 ) = work%nc2of
CALLS( 2 ) = work%nc2og
CALLS( 3 ) = work%nc2oh
CALLS( 4 ) = work%nhvpr
CALLS( 1 ) = REAL( work%nc2of, rp_)
CALLS( 2 ) = REAL( work%nc2og, rp_)
CALLS( 3 ) = REAL( work%nc2oh, rp_)
CALLS( 4 ) = REAL( work%nhvpr, rp_)

status = 0
RETURN
Expand Down

0 comments on commit d78ea67

Please sign in to comment.