Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Rollins__Greg
Beginner
57 Views

Trunst Region optimization dtrnlsp_solve aborts intermittently returning 1502

I'm calling dtrnlsp_solve from C++.   Depending on changes to the surrounding code, compile options (debug vs optimized) etc, Sometimes it works, sometimes it fails on the first call, returning code 1502.  What does the code mean?   Any suggestions on how to fix it? I can't find anything wrong in my code.

CENTRAL_MKL_LIB = /depot/intel/math_kernel_library_2018.1.163/mkl

MATH_LIBS_linux64      = -Wl,--start-group $(CENTRAL_MKL_LIB)/intel64/libmkl_intel_lp64.a $(CENTRAL_MKL_LIB)/intel64/libmkl_sequential.a $(CENTRAL_MKL_LIB)/intel64/libmkl_core.
a -Wl,--end-group -lpthread -lm

For a while it was working if compiled optimized but aborting if compiled debug.  Then I included the call to dtrnlsp_check (see below) and then it would work compiled debug but not optimized.  Then I change some code an another file and now it always fails??? 

double *xx = (double*) malloc (sizeof (double)*nn);
  double *fjac = (double*) malloc (sizeof (double)*nn*sz2);
  double *fvec= (double*) malloc (sizeof (double)*sz2);
  for(int i=0; i<nn; i++) xx=0.0;
  for(int i=0; i<sz2*nn; i++) fjac=0.0;
  for(int i=0; i<sz2; i++) fvec=0.0;
  double eps[6]={.00001, 0.00001, 0.00001, 0.00001, 0.00001, 0.00001};
  MKL_INT iter1=100;
  MKL_INT iter2=10;
  double rs=0.0;
  int res = dtrnlsp_init(&handle, &nn, &sz2, xx, eps, &iter1, &iter2, &rs);
  if(res != TR_SUCCESS) {
    printf("ERROR SCE dtrnlsp_init failed\n");
    exit(1);
  }
#if 0 
  MKL_INT info[6];
  res = dtrnlsp_check(&handle, &nn, &sz2, fjac, fvec, eps, info);
  if(res != TR_SUCCESS) {
    printf("ERROR SCE dtrnlsp_check failed  code=%d\n", res);
    exit(1);
  }
#endif
  MKL_INT  RCI_Request;
  int success=0;
  while(success == 0){
    res = dtrnlsp_solve(&handle, fvec, fjac, &RCI_Request);
    if(res != TR_SUCCESS) {
      printf("ERROR SCE dtrnlsp_solve failed code=%d\n", res);
      exit(1);
    }

......

Thanks

Greg

0 Kudos
1 Reply
Gennady_F_Intel
Moderator
57 Views

Greg, it might be the real issue. Could you give the compatible case to start investigation on our side? Right now, I see several undefined variables while compiling this case.... nn, sz2...

Reply