Skip to content
This repository was archived by the owner on Apr 13, 2021. It is now read-only.

Commit 01ff809

Browse files
committed
Merge pull request #184 from imh/lapack-mem
Disabled the LAPACK functions that take too much memory
2 parents 10c6337 + 5fa68b7 commit 01ff809

38 files changed

+460
-119
lines changed

clapack-3.2.1-CMAKE/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ set(CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_DEBUG}")
33
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
44
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
55

6+
# Disable some of the really awful functions that allocate so much memory
7+
set(CMAKE_C_FLAGS "-DLAPACK_DISABLE_MEMORY_HOGS ${CMAKE_C_FLAGS}")
8+
69
# Build libraries with PIC flag as they will be linked into shared objects
710
if (NOT CMAKE_CROSSCOMPILING)
811
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

clapack-3.2.1-CMAKE/SRC/cgbtrf.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "f2c.h"
1414
#include "blaswrap.h"
15+
#include "assert.h"
1516

1617
/* Table of constant values */
1718

@@ -41,8 +42,17 @@ static integer c__65 = 65;
4142
complex *, integer *), ccopy_(integer *, complex *, integer *,
4243
complex *, integer *), cswap_(integer *, complex *, integer *,
4344
complex *, integer *);
44-
complex work13[4160] /* was [65][64] */, work31[4160] /*
45-
was [65][64] */;
45+
#ifdef LAPACK_DISABLE_MEMORY_HOGS
46+
complex work13[1] /* was [65][64] */, work31[1] /*
47+
was [65][64] */;
48+
/** This function uses too much memory, so we stopped allocating the memory
49+
* above and assert false here. */
50+
assert(0 && "cgbtrf_ was called. This function allocates too much"
51+
" memory and has been disabled.");
52+
#else
53+
complex work13[4160] /* was [65][64] */, work31[4160] /*
54+
was [65][64] */;
55+
#endif
4656
extern /* Subroutine */ int ctrsm_(char *, char *, char *, char *,
4757
integer *, integer *, complex *, complex *, integer *, complex *,
4858
integer *), cgbtf2_(integer *,
@@ -151,6 +161,7 @@ static integer c__65 = 65;
151161
/* .. */
152162
/* .. Executable Statements .. */
153163

164+
154165
/* KV is the number of superdiagonals in the factor U, allowing for */
155166
/* fill-in */
156167

clapack-3.2.1-CMAKE/SRC/cgehrd.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "f2c.h"
1414
#include "blaswrap.h"
15+
#include "assert.h"
1516

1617
/* Table of constant values */
1718

@@ -32,7 +33,15 @@ static integer c__65 = 65;
3233

3334
/* Local variables */
3435
integer i__, j;
35-
complex t[4160] /* was [65][64] */;
36+
#ifdef LAPACK_DISABLE_MEMORY_HOGS
37+
complex t[1] /* was [65][64] */;
38+
/** This function uses too much memory, so we stopped allocating the memory
39+
* above and assert false here. */
40+
assert(0 && "cgehrd_ was called. This function allocates too much"
41+
" memory and has been disabled.");
42+
#else
43+
complex t[4160] /* was [65][64] */;
44+
#endif
3645
integer ib;
3746
complex ei;
3847
integer nb, nh, nx, iws;

clapack-3.2.1-CMAKE/SRC/chseqr.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "f2c.h"
1414
#include "blaswrap.h"
15+
#include "assert.h"
1516

1617
/* Table of constant values */
1718

@@ -37,7 +38,15 @@ static integer c__49 = 49;
3738
/* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen);
3839

3940
/* Local variables */
40-
complex hl[2401] /* was [49][49] */;
41+
#ifdef LAPACK_DISABLE_MEMORY_HOGS
42+
complex hl[1] /* was [49][49] */;
43+
/** This function uses too much memory, so we stopped allocating the memory
44+
* above and assert false here. */
45+
assert(0 && "chseqr_ was called. This function allocates too much"
46+
" memory and has been disabled.");
47+
#else
48+
complex hl[2401] /* was [49][49] */;
49+
#endif
4150
integer kbot, nmin;
4251
extern logical lsame_(char *, char *);
4352
extern /* Subroutine */ int ccopy_(integer *, complex *, integer *,

clapack-3.2.1-CMAKE/SRC/cpbtrf.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "f2c.h"
1414
#include "blaswrap.h"
15+
#include "assert.h"
1516

1617
/* Table of constant values */
1718

@@ -31,7 +32,15 @@ static integer c__33 = 33;
3132

3233
/* Local variables */
3334
integer i__, j, i2, i3, ib, nb, ii, jj;
34-
complex work[1056] /* was [33][32] */;
35+
#ifdef LAPACK_DISABLE_MEMORY_HOGS
36+
complex work[1] /* was [33][32] */;
37+
/** This function uses too much memory, so we stopped allocating the memory
38+
* above and assert false here. */
39+
assert(0 && "cpbtrf_ was called. This function allocates too much"
40+
" memory and has been disabled.");
41+
#else
42+
complex work[1056] /* was [33][32] */;
43+
#endif
3544
extern /* Subroutine */ int cgemm_(char *, char *, integer *, integer *,
3645
integer *, complex *, complex *, integer *, complex *, integer *,
3746
complex *, complex *, integer *), cherk_(char *,

clapack-3.2.1-CMAKE/SRC/cunmlq.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "f2c.h"
1414
#include "blaswrap.h"
15+
#include "assert.h"
1516

1617
/* Table of constant values */
1718

@@ -35,7 +36,15 @@ static integer c__65 = 65;
3536

3637
/* Local variables */
3738
integer i__;
38-
complex t[4160] /* was [65][64] */;
39+
#ifdef LAPACK_DISABLE_MEMORY_HOGS
40+
complex t[1] /* was [65][64] */;
41+
/** This function uses too much memory, so we stopped allocating the memory
42+
* above and assert false here. */
43+
assert(0 && "cunmlq_ was called. This function allocates too much"
44+
" memory and has been disabled.");
45+
#else
46+
complex t[4160] /* was [65][64] */;
47+
#endif
3948
integer i1, i2, i3, ib, ic, jc, nb, mi, ni, nq, nw, iws;
4049
logical left;
4150
extern logical lsame_(char *, char *);

clapack-3.2.1-CMAKE/SRC/cunmql.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "f2c.h"
1414
#include "blaswrap.h"
15+
#include "assert.h"
1516

1617
/* Table of constant values */
1718

@@ -35,7 +36,15 @@ static integer c__65 = 65;
3536

3637
/* Local variables */
3738
integer i__;
38-
complex t[4160] /* was [65][64] */;
39+
#ifdef LAPACK_DISABLE_MEMORY_HOGS
40+
complex t[1] /* was [65][64] */;
41+
/** This function uses too much memory, so we stopped allocating the memory
42+
* above and assert false here. */
43+
assert(0 && "cunmql_ was called. This function allocates too much"
44+
" memory and has been disabled.");
45+
#else
46+
complex t[4160] /* was [65][64] */;
47+
#endif
3948
integer i1, i2, i3, ib, nb, mi, ni, nq, nw, iws;
4049
logical left;
4150
extern logical lsame_(char *, char *);

clapack-3.2.1-CMAKE/SRC/cunmqr.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "f2c.h"
1414
#include "blaswrap.h"
15+
#include "assert.h"
1516

1617
/* Table of constant values */
1718

@@ -35,7 +36,15 @@ static integer c__65 = 65;
3536

3637
/* Local variables */
3738
integer i__;
38-
complex t[4160] /* was [65][64] */;
39+
#ifdef LAPACK_DISABLE_MEMORY_HOGS
40+
complex t[1] /* was [65][64] */;
41+
/** This function uses too much memory, so we stopped allocating the memory
42+
* above and assert false here. */
43+
assert(0 && "cunmqr_ was called. This function allocates too much"
44+
" memory and has been disabled.");
45+
#else
46+
complex t[4160] /* was [65][64] */;
47+
#endif
3948
integer i1, i2, i3, ib, ic, jc, nb, mi, ni, nq, nw, iws;
4049
logical left;
4150
extern logical lsame_(char *, char *);

clapack-3.2.1-CMAKE/SRC/cunmrq.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "f2c.h"
1414
#include "blaswrap.h"
15+
#include "assert.h"
1516

1617
/* Table of constant values */
1718

@@ -35,7 +36,15 @@ static integer c__65 = 65;
3536

3637
/* Local variables */
3738
integer i__;
38-
complex t[4160] /* was [65][64] */;
39+
#ifdef LAPACK_DISABLE_MEMORY_HOGS
40+
complex t[1] /* was [65][64] */;
41+
/** This function uses too much memory, so we stopped allocating the memory
42+
* above and assert false here. */
43+
assert(0 && "cunmrq_ was called. This function allocates too much"
44+
" memory and has been disabled.");
45+
#else
46+
complex t[4160] /* was [65][64] */;
47+
#endif
3948
integer i1, i2, i3, ib, nb, mi, ni, nq, nw, iws;
4049
logical left;
4150
extern logical lsame_(char *, char *);

clapack-3.2.1-CMAKE/SRC/cunmrz.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "f2c.h"
1414
#include "blaswrap.h"
15+
#include "assert.h"
1516

1617
/* Table of constant values */
1718

@@ -36,7 +37,15 @@ static integer c__65 = 65;
3637

3738
/* Local variables */
3839
integer i__;
39-
complex t[4160] /* was [65][64] */;
40+
#ifdef LAPACK_DISABLE_MEMORY_HOGS
41+
complex t[1] /* was [65][64] */;
42+
/** This function uses too much memory, so we stopped allocating the memory
43+
* above and assert false here. */
44+
assert(0 && "cunmrz_ was called. This function allocates too much"
45+
" memory and has been disabled.");
46+
#else
47+
complex t[4160] /* was [65][64] */;
48+
#endif
4049
integer i1, i2, i3, ib, ic, ja, jc, nb, mi, ni, nq, nw, iws;
4150
logical left;
4251
extern logical lsame_(char *, char *);

0 commit comments

Comments
 (0)