optix project was terminated abnormally

The optix is applied to numeric calculation in my project, during the process serveral arrays should be declared
to hold the intermediate result. As you know, optix doesn’t provide the function of dynamic memory allocation, so
the size of arrays should be larger than what I need, but the memory we can use is limited.
When I launch my project, it is terminated without excuting all the codes, if I reduce the size of the arrays, sometimes
the project can run successfully, so I’m afraid the termination is caused because of the memory is used up, but I’m not
quite sure.
How can I know how much device memory has been used? If the condition is caused by the insufficient memory, how can I
optimise my code to save some memory. Thank you for answering!

You can use rtContextGetAttribute and RT_CONTEXT_ATTRIBUTE_AVAILABLE_DEVICE_MEMORY to get device memory usage.

When your program is terminated abnormally, you should get an error code and an error message; what does it say?

Thank you,m_sch
I tried the function of rtContextGetAttribute, it showed that the free memory is 745316352,which is about 710MB, the total device memory of my display card is 1GB. Taking the complication of my project into consideration, I don’t think the free memory would be 710MB. Maybe I didn’t put function in the right place, however the api-reference doesn’t mention where to put it, I will appreciate it if you can give me some more information.

Sorry, I didn’t clarify my problem clearly. The project is terminated without exception or error, which means from apparently look, it is all right with nothing wrong. There is a loop in the .cu file, I have tried to print the result during each loop, it just print a part of the data, that is to say, it doesn’t excute the loop completely. But if I reduce the size of memory used, it sometimes excute the loop completely. So I am not sure what the problem should be.

Have you enabled OptiX exceptions ?
If not, this could be a way to see what the problem is really. See section 4.4 to make an exception program and to enable it.

This happened to me a few times : my program seemed like it worked but it didn’t, but it wasn’t showing any sign of failure since exceptions were disabled in release mode.

Thank you,HamzaC.

I have enabled all the exceptions with following code:
context->setExceptionEnabled(RT_EXCEPTION_ALL,1);
But it is still terminated without giving an exception, it is really weird.

How large are you setting your stack? I get similar errors when I set the stack size too low. Sometimes it doesn’t even give me a stack overflow exception, just quits before completion.