cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

kos
Journeyman III

How to debug CAL ?

I have a Cal_Result_Error as a result of calCtxRunProgram, and don't know why...

MY code :

CALmodule module = 0;
  Context = Params[0].first.dev.ContextHandle;
  CALresult r = calModuleLoad(&module, Context, image);
  CALfunc func = 0;
  calModuleGetEntry(&func,Context, module, "main");
  for(int i = 0; i < Params.size(); i++)
  {
  CALname Name = 0;
  calModuleGetName(&Name, Context, module, Params.second.c_str());
  calCtxSetMem(Context, Name, Params
.first.Memory);
  }
  CALdomain domain = {0, 0, Params[0].first.region.first, Params[0].first.region.second};
  e = 0;
  CALresult re = calCtxRunProgram(&e, Context, func, &domain);
func, Context - are good, another piece of similar code works good in another project, with the same values. I've tried different domains, result the same. In similar project context and func pointers that I've got from CAL runtime are the same - in different apps running at the same time, and one of that works, no matter is another app started or not.

0 Likes
4 Replies
jean-claude
Journeyman III

Did you check all your I/Os are set properly for func ?

0 Likes

Do you mean this :

  CALfunc func = 0;
  calModuleGetEntry(&func,Context, module, "main");
  for(int i = 0; i < Params.size(); i++)
  {
  CALname Name = 0;
  calModuleGetName(&Name, Context, module, Params.second.c_str());
  calCtxSetMem(Context, Name, Params
.first.Memory);
  }

module and func are good, I'd tested this project with IL from my previous project, all names, all context, module, func, memory, resourse hendlers had the same values as in this project, but the difference is that I'm using some C++ feautures like static var in template class and so on. The most part of code is the same, but It just can't work...

0 Likes

Hi Kos,

I don't have details of your code, a lot of things can cause the misbehaviour...

...but what rings a bell are the parameters Params.second.c_str() and Params.first.Memory.

How do they relate to variable i?

A priori you should have something like during the i loop :

             Params.second.c_str()     gives           i0          i1     ....       O1    ...   
While    Params.first.Memory        gives     Mem1    Mem2    ....    Mem3    ...

Jean-Claude

0 Likes

There are missed brackets in previous post, forum's engine has deleted them. And they contained i between them/

 



0 Likes