-
Notifications
You must be signed in to change notification settings - Fork 416
Crash when re-initialized after finalized #525
Copy link
Copy link
Closed
Description
When bli_finalize() is called, then it is not possible to re-initialize the library with bli_init(). Doing so causes a crash in the next call to bli_dgemm(). The code snippet below is a working example to reproduce this.
It would be useful to allow re-initializing the library after it has been finalized. In our application we would like to deallocate the memory after part of the computation is finished, and reallocate later if needed for another part.
#include "blis.h"
static void do_work()
{
enum {DIM_M = 4, DIM_N = 5, DIM_K = 3};
double a[DIM_M*DIM_K], b[DIM_K*DIM_N], c[DIM_M*DIM_N];
double zero = 0.0, one = 1.0, alpha = 2.0, beta = 3.0;
const int m = DIM_M;
const int n = DIM_N;
const int k = DIM_K;
const int csa = m;
const int csb = k;
const int csc = m;
const int rsa = 1;
const int rsb = 1;
const int rsc = 1;
bli_drandm(0, BLIS_DENSE, m, k, a, rsa, csa);
bli_dsetm(BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
k, n, &one, b, rsb, csb);
bli_dsetm(BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &zero, c, rsc, csc);
bli_dgemm(BLIS_NO_TRANSPOSE, BLIS_NO_TRANSPOSE,
m, n, k, &alpha, a, rsa, csa, b, rsb, csb,
&beta, c, rsc, csc);
bli_dprintm("c: after gemm", m, n, c, rsc, csc, "%4.1f", "");
}
int main()
{
bli_init();
do_work();
bli_finalize();
bli_init();
do_work();
bli_finalize();
return 0;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels