Author Topic: how to use "python.exe" instead of "runkratos.exe"?  (Read 610 times)

galavi

  • Newbie
  • *
  • Posts: 8
how to use "python.exe" instead of "runkratos.exe"?
« on: November 07, 2016, 10:12:45 PM »
Hi,

I am using some IDEs (under Windows) for python (for example Visual Studio or PyCharm) in order to run/debug Kratos examples. When I use these IDEs, I am not able to set "runkratos.exe" as the interpreter of the script. Therefore, I have to use "python.exe".

In some cases, using "python.exe" leads to numerical problems such as NaN or INF in the implicit solver. I do not have this type of problems, when I run the script with "runkratos.exe".

It is written in the installation part of this website that "runkratos.exe" sets some environment variables and it is recommended to use it instead of "python.exe". What variables are set by runkratos.exe? Is there any way to use "python.exe" instead of "runkratos.exe" without problems?

Thanks in advance,

Vahid

pooyan

  • Global Moderator
  • Newbie
  • *****
  • Posts: 33
Re: how to use "python.exe" instead of "runkratos.exe"?
« Reply #1 on: November 08, 2016, 05:04:17 PM »
Basically runkratos is a simple wrapper over the python and only ensures that you are using the same version of python as you compiled the rest of the Kratos. It should not affect in other ways. Meanwhile your problem has the symptom of having a memory error. So I would encourage you to check memory leak with valgrind and/or compile with full debug using following macros in your configure:
Code: [Select]
-DDO_NOT_DEFINE_NDEBUG=ON
-DKRATOS_DEBUG=ON
 

galavi

  • Newbie
  • *
  • Posts: 8
Re: how to use "python.exe" instead of "runkratos.exe"?
« Reply #2 on: November 13, 2016, 06:29:13 PM »
Thanks Pooyan!

I debugged the code in VS2015 using the debug options as you suggested and I got an error from file data_value_container.h, line 194:

#ifdef KRATOS_DEBUG
        if(OpenMPUtils::IsInParallel() != 0)
            KRATOS_ERROR << "attempting to do a GetValue for: " << rThisVariable << " unfortunately the variable is not in the database and the operations is not threadsafe (this function is being called from within a parallel region)" << std::endl;
#endif

It seems that the operation is not thread safe.

I ran the example using one thread without the debug options and the same issue (i.e. INF and NaN) happened. However, when I set "Basic Runtime checks" in ParticleMechanicsApplication to "Uninitialized variables (/RTCu)", the code ran without error and did not produce INF and NaN.

There must be some memory issues which need more investigations.

Best regards,

Vahid


pooyan

  • Global Moderator
  • Newbie
  • *****
  • Posts: 33
Re: how to use "python.exe" instead of "runkratos.exe"?
« Reply #3 on: November 14, 2016, 08:10:17 AM »
Meanwhile I would suggest you to add the variable you miss in your nodal data container to your python. This is a common error and gives you problem every now and then.

Bests,

galavi

  • Newbie
  • *
  • Posts: 8
Re: how to use "python.exe" instead of "runkratos.exe"?
« Reply #4 on: November 18, 2016, 06:18:13 PM »
Thanks Pooyan for your help.