Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use official lapack instead of local, thread unsafe, copy. #1151

Merged
merged 1 commit into from
Oct 24, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion PhysicsTools/MVATrainer/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<library file="module.cc" name="PhysicsToolsMVATrainerPlugins">
<flags EDM_PLUGIN="1"/>
</library>
<library file="ProcMLP.cc MLP*.cc mlp*.cc mlp_lapack.c" name="PhysicsToolsMVATrainerProcMLP">
<library file="ProcMLP.cc MLP*.cc mlp*.cc" name="PhysicsToolsMVATrainerProcMLP">
<lib name="lapack"/>
<flags EDM_PLUGIN="1"/>
</library>
<library file="ProcTMVA.cc" name="PhysicsToolsMVATrainerProcTMVA">
Expand Down
35 changes: 16 additions & 19 deletions PhysicsTools/MVATrainer/plugins/mlp_gen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ dbl **Hessian;
/* The following lines are needed to use the dgels routine from the LAPACK
library in Reslin() */

#include "mlp_lapack.h"
/* Subroutine */ int dgels_(char *trans, integer *m, integer *n, integer *
nrhs, doublereal *a, integer *lda, doublereal *b, integer *ldb,
doublereal *work, integer *lwork, integer *info);
/* Subroutine */ int dgels_(char *trans, int *m, int *n, int *
nrhs, double *a, int *lda, double *b, int *ldb,
double *work, int *lwork, int *info);

/***********************************************************/
/* MLP_Out */
Expand All @@ -62,8 +61,7 @@ dbl **Hessian;

/* extern "C"Dllexport */void MLP_Out(type_pat *rrin, dbl *rrout)
{
// static int i, il, in, j, ilm1, m, mp1;
static int i, il, in, j, m, mp1;
int i, il, in, j, m, mp1;
dbl **deriv1;

/* input layer */
Expand Down Expand Up @@ -114,7 +112,7 @@ dbl **Hessian;

/* extern "C"Dllexport */void MLP_Out_T(type_pat *rrin)
{
static int i, il, in, j, ilm1, m, mp1;
int i, il, in, j, ilm1, m, mp1;
register dbl a;

/* input layer */
Expand Down Expand Up @@ -185,8 +183,7 @@ dbl **Hessian;

/* extern "C"Dllexport */void MLP_Out2(type_pat *rrin)
{
// static int il, in, m, mp1, i0, ilm1;
static int il, in, m, mp1;
int il, in, m, mp1;
register int i;
dbl **rrout, **deriv1;
register dbl *prrout;
Expand Down Expand Up @@ -1970,16 +1967,16 @@ void MLP_ResLin()
{
/* dbl rrans[NMAX], rrout[NMAX];*/
/* type_pat rrin[NMAX];*/
doublereal *HR,*dpat; //,*wlin,*SV;
double *HR,*dpat; //,*wlin,*SV;
double err,lambda,lambda2;
integer Nl,M,Nhr,khr,nrhs,iret,ierr;
int Nl,M,Nhr,khr,nrhs,iret,ierr;
int il, in, inl, ipat;
/*register dbl a;*/ //a unused
char Trans = 'N';


/* integer rank; */
// doublereal rcond = -1; /* use machine precision */
/* int rank; */
// double rcond = -1; /* use machine precision */

lambda2 = LEARN.Alambda;

Expand All @@ -1988,16 +1985,16 @@ void MLP_ResLin()
Nl = NET.Nneur[NET.Nlayer-2] + 1;
M = PAT.Npat[0]+Nl;

integer Lwork = 5 * M;
doublereal *Work = (doublereal*) malloc((int) Lwork*sizeof(doublereal));
int Lwork = 5 * M;
double *Work = (double*) malloc((int) Lwork*sizeof(double));

/* memory allocation */
dpat = (doublereal*) malloc((int) M*sizeof(doublereal));
// wlin = (doublereal*) malloc((int) Nl*sizeof(doublereal));
// SV = (doublereal*) malloc((int) Nl*sizeof(doublereal));
dpat = (double*) malloc((int) M*sizeof(double));
// wlin = (double*) malloc((int) Nl*sizeof(double));
// SV = (double*) malloc((int) Nl*sizeof(double));

Nhr = M * Nl;
HR = (doublereal*) malloc((int) Nhr*sizeof(doublereal));
HR = (double*) malloc((int) Nhr*sizeof(double));
err = 0.;
for(ipat=0;ipat<PAT.Npat[0];ipat++)
{
Expand Down
Loading