- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

for (i=0; i

*;*

//dsctr(&sep,x,&geom[3],tmp4);

This is on gcc 4.5.1, mkl 10.3 update 9

thanks

T

gcc -std=gnu99 -fpic -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -c n02.c -o n02.o

gcc -std=gnu99 -shared -L/opt/intel/composer_xe_2011_sp1.9.293/mkl/lib/intel64 -L/opt/intel/composer_xe_2011_sp1.9.293/compiler/lib/intel64 -lmkl_rt -lpthread n02.o -o n02.so

//dsctr(&sep,x,&geom[3],tmp4);

This is on gcc 4.5.1, mkl 10.3 update 9

thanks

T

gcc -std=gnu99 -fpic -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -c n02.c -o n02.o

gcc -std=gnu99 -shared -L/opt/intel/composer_xe_2011_sp1.9.293/mkl/lib/intel64 -L/opt/intel/composer_xe_2011_sp1.9.293/compiler/lib/intel64 -lmkl_rt -lpthread n02.o -o n02.so

Link Copied

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Segfault occurs ony when dsctr function is not commented out, and occurs not when I manually (for loop) do what dsctr is doing.

#include

#include

#include

#include

double lprg(double *x, double *xx, int *geom, double *g, double *tmp1, double *tmp2, double *tmp3, double *tmp4) {

int sep = geom[0]*geom[1]-(((geom[1]-1)*geom[1])/2); double one = 1.0; double zero = 0; int info, i; double n=-geom[2];

double lp=1; int sz = geom[0]*geom[0]; int zeri = 0; int onei = 1; int j = 0;

printf("\n x \n"); for (i=0; i<2*geom[0]; i++) printf("%d %f ", i, x

*);*

printf("\n xx \n"); for (i=0; i);

printf("\n geom \n"); for (i=0; i);

printf("\n g \n"); for (i=0; i<2*geom[0]; i++) printf("%d %f ", i, g

printf("\n xx \n"); for (i=0; i

printf("\n geom \n"); for (i=0; i

printf("\n g \n"); for (i=0; i<2*geom[0]; i++) printf("%d %f ", i, g

*);*

printf("\n tmp1 \n"); for (i=0; i);

printf("\n tmp2 \n"); for (i=0; i);

printf("\n tmp3 \n"); for (i=0; i);

printf("\n tmp4 \n"); for (i=0; i);

dcopy(&sz,&zero,&zeri,tmp1,&onei);

for (i=0; i for (i=0; i = x

printf("\n tmp1 \n"); for (i=0; i

printf("\n tmp2 \n"); for (i=0; i

printf("\n tmp3 \n"); for (i=0; i

printf("\n tmp4 \n"); for (i=0; i

dcopy(&sz,&zero,&zeri,tmp1,&onei);

for (i=0; i

*;*

dsctr(&sep,x,&geom[3],tmp4);

lp = 5;

printf("%f ", lp);

return lp;

}

FreeMat -nogui

import('/home/s/mlfm/n02dbg.so','lprg','lprg','double','double &x, double &xx, int32 &geom, double &g, double &tmp1, double &tmp2, double &tmp3, double &tmp4');

the = [1.5,3.4,2.8,1.1,3,3,0.3,0.7,0.4,0.7,0.5,0.2];

p = 6; q = 1;

x = eye(p)

geom = [p,q,100,1:p]

g = zeros(2*p,1)

tmp1 = zeros(p,p); tmp2 = zeros(p,p); tmp3 = zeros(p,p); tmp4 = zeros(p,p);

l = lprg(the,x,geom,g,tmp1,tmp2,tmp3,tmp4)

dsctr(&sep,x,&geom[3],tmp4);

lp = 5;

printf("%f ", lp);

return lp;

}

FreeMat -nogui

import('/home/s/mlfm/n02dbg.so','lprg','lprg','double','double &x, double &xx, int32 &geom, double &g, double &tmp1, double &tmp2, double &tmp3, double &tmp4');

the = [1.5,3.4,2.8,1.1,3,3,0.3,0.7,0.4,0.7,0.5,0.2];

p = 6; q = 1;

x = eye(p)

geom = [p,q,100,1:p]

g = zeros(2*p,1)

tmp1 = zeros(p,p); tmp2 = zeros(p,p); tmp3 = zeros(p,p); tmp4 = zeros(p,p);

l = lprg(the,x,geom,g,tmp1,tmp2,tmp3,tmp4)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

We haven't FreeMat-nogui , so can't do the test. just quick idea, would you please help to try to replace the singledynamic library"-lmkl_rt" with the static link mode:

-Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a $(MKLROOT)/lib/intel64/libmkl_sequential.a $(MKLROOT)/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread

(as MKL link advisor suggestedhttp://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/)

and see if it is dynamic link issue or the function itself issue.

Thanks

Ying

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

FreeMat is freely available opensource, usually comes with the distro, 2 clicks and its installed (yast).

When I link statically, everything compiles fine, but when running, I get "MKL FATAL ERROR: Cannot load neither libmkl_mc3.so nor libmkl_def.so" even though I issued before starting FreeMat:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/composer_xe_2011_sp1.9.293/mkl/lib/intel64

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/composer_xe_2011_sp1.9.293/compiler/lib/intel64

and the 2 so files are present in these directories.

T

gcc -std=gnu99 -shared -Wl,--start-group /opt/intel/composer_xe_2011_sp1.9.293/mkl/lib/intel64/libmkl_intel_lp64.a /opt/intel/composer_xe_2011_sp1.9.293/mkl/lib/intel64/libmkl_intel_thread.a /opt/intel/composer_xe_2011_sp1.9.293/mkl/lib/intel64/libmkl_core.a -Wl,--end-group -L/opt/intel/composer_xe_2011_sp1.9.293/compiler/lib/intel64 -liomp5 -lpthread -lm -lm n02dbg.o -o n02dbg.so

same error when I put sequential.a

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

#include

#include

#include

#include

double lprg(double *x, double *xx, int *geom, double *g, double *tmp1, double *tmp2, double *tmp3, double *tmp4) {

int sep = geom[0]*geom[1]-(((geom[1]-1)*geom[1])/2); double one = 1.0; double zero = 0; int info, i; double n=-geom[2];

double lp=1; int sz = geom[0]*geom[0]; int zeri = 0; int onei = 1; int j = 0;

printf("\n x \n"); for (i=0; i<2*geom[0]; i++) printf("%d %f ", i, x

*);*

printf("\n xx \n"); for (i=0; i);

printf("\n geom \n"); for (i=0; i);

printf("\n g \n"); for (i=0; i<2*geom[0]; i++) printf("%d %f ", i, g

printf("\n xx \n"); for (i=0; i

printf("\n geom \n"); for (i=0; i

printf("\n g \n"); for (i=0; i<2*geom[0]; i++) printf("%d %f ", i, g

*);*

printf("\n tmp1 \n"); for (i=0; i);

printf("\n tmp2 \n"); for (i=0; i);

printf("\n tmp3 \n"); for (i=0; i);

printf("\n tmp4 \n"); for (i=0; i);

dcopy(&sz,&zero,&zeri,tmp1,&onei);

for (i=0; i for (i=0; i = x

printf("\n tmp1 \n"); for (i=0; i

printf("\n tmp2 \n"); for (i=0; i

printf("\n tmp3 \n"); for (i=0; i

printf("\n tmp4 \n"); for (i=0; i

dcopy(&sz,&zero,&zeri,tmp1,&onei);

for (i=0; i

*;*

// dsctr(&sep,x,&geom[3],tmp4);

// for (i=0; i);

dsyrk("u","n",&geom[0],&geom[1],&one,tmp4,&geom[0],&one,tmp1,&geom[0]); // t(lam)*lam+diag(sig)

dpotrf("u",&geom[0],tmp1,&geom[0],&info); //LU-decomposition

lp = 5;

printf("%f ", lp);

return lp;

}

// dsctr(&sep,x,&geom[3],tmp4);

// for (i=0; i

dsyrk("u","n",&geom[0],&geom[1],&one,tmp4,&geom[0],&one,tmp1,&geom[0]); // t(lam)*lam+diag(sig)

dpotrf("u",&geom[0],tmp1,&geom[0],&info); //LU-decomposition

lp = 5;

printf("%f ", lp);

return lp;

}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

*> FreeMat is freely available opensource, usually comes with the distro, 2 clicks and its installed (yast).*

Yes, if you have a Linux distribution that uses YAST. I can also download the source of the Linux kernel but I am certainly not going to rebuild it to find a Fortran bug.

I think that it is too much to expect someone else to build a thirdy party software from source merely to help you with a bug. I suggest that we break the problem up.

1. On your installation, print out the arguments to the Fortran function/subroutine just before that routine gets called from FreeMat (or some thirdy party software). If that is too difficult, do the printing as the first executable statement in the Fortran routine -- this will work only if the subroutine linkage is already correct.

2. Write a small Fortran driver to call the subroutine with the arguments that you collected in 1. If the error goes away, then the problem is not with the Fortran code or the Intel compiler, but with FreeMat and how it calls Fortran routines. If the error remains, it should be easy to get assistance to fix here. Post the driver and the subroutine(s).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

I installed onedistr:FreeMat-4.1.fc14.x86_64.rpm, but it seems failed as i haven'trelated Linuxdistro and related library, so not move forword

But i tried the related c code, add a main() under your functions.

int main(){

double the[]={1.5,3.4,2.8,1.1,3,3,0.3,0.7,0.4,0.7,0.5,0.2};

int p =6;

int q =1;

double x[6*6]={0.0};

for (int i=0; i<6; i++)

x[i*6+i]=1.0;

int geom[9]={6,1, 100, 1, 2, 3, 4, 5, 6};

double g[12]={0.0};

double tmp1[36]={0.0};

double tmp2[36]={0.0};

double tmp3[36]={0.0};

double tmp4[36]={0.0};

double lp= lprg(the,x, geom, g, tmp1, tmp2, tmp3,tmp4);

return 0;

}

Same as your gcc commands, just remove -shared, thusget a exe. It can run no problem with MKL 10.3. 9and-lmkl_rt.

The problemlooks betweenFreeMat and on.so .

Regarding the static link , It product the error, likeMKL FATAL ERROR: Cannot load neither libmkl_mc3.so nor libmkl_def.so".The resultis unexpected as libmkl_mc3.so and libmkl_def.so are dynamic library. So it shoud hint there is some MKLdynamic library was linked in your binary. Could you please check if the old '/home/s/mlfm/n02dbg.so' have been updated?

or > ldd '/home/s/mlfm/n02dbg.so' and let us know the result.

Best Regards,

Ying

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page