Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel ICX Compiler , Intel® DPC++ Compatibility Tool, and GDB*

Memory growth in DPC++ application with USM

baranovsky
Beginner
1,801 Views

Hi,

I'm developing a fluid simulator using DPC++, but the application's memory consumption grows so rapidly that practical simulation cannot be ran.

As kernel functions executed repeatedly, the memory consumption of my application monotonously grows. And, the memory growth will not reset even if sycl::queue is deleted.

I attached a small source code which reproduced the problem in my environment:

    Windows 11 Enterprise

    Microsoft Visual Studio Professional 2019 Version 16.11.8

    Intel oneAPI 2021.4

 

Is there any idea for the cause, and possible solutions?

Thank you for your help in advance.

 

--- source code (which I failed to attach as a file) ---

#include <CL/sycl.hpp>

int main(int argc, char* argv[])

{

    for (auto loop = 0; loop < 2; loop++)
    {
         std::cout << "loop #" << loop << std::endl;

         sycl::queue queue(sycl::cpu_selector{});
         auto* data = sycl::malloc_device<double>(1024, queue);
         sycl::event e;

         for (auto i = 0; i < 100000; i++)
         {
             e = queue.submit([data, e](sycl::handler& cgh)
             {
                  cgh.depends_on(e);

                  cgh.parallel_for(sycl::range<1>(1024), [data](sycl::item<1> item)
                  {
                      data[item.get_linear_id()] = item.get_linear_id();
                  });
              });
         }
         queue.wait();
         sycl::free(data, queue);
     }

     return 0;
}

Labels (1)
0 Kudos
1 Solution
clevels
Moderator
1,348 Views

Hello- there has been an update from the development team. With the oneAPI 2022.1.0 compiler they are seeing the following memory consumption graph using massif, which seems to be in line with what is expected:


If you are still able to reproduce this issue with the latest version, could you please provide detailed steps (compilation and run commands) along with the compiler and OpenCL CPU runtime versions?


run commands for above graph:

$dpcpp test.cpp

$valgrind --tool=massif ./a.out



View solution in original post

0 Kudos
8 Replies
NoorjahanSk_Intel
Moderator
1,774 Views

Hi,


Thanks for reaching out to us.


>>the memory consumption of my application monotonously grows And, the memory growth will not reset even if sycl::queue is deleted.


Could you please elaborate more about the above statement?

Also please do let us know, how did you test the memory consumption of the application?


Also could you please confirm the issue with the latest version of oneAPI which is 2022.1?


Thanks & Regards,

Noorjahan


0 Kudos
baranovsky
Beginner
1,758 Views

Thank you Noorjahan.

 

I've tested my application with Visual Studio's "Diagnostic Tools".

When I change the source code to loop the first for-loop 100 times, the process memory grows from 100MB to 900MB.

I've also confirmed the issue with the latest version (Intel oneAPI 2022.1)

(please see the image attached: 2021.4.png and 2022.1.png)

 

 

 

0 Kudos
baranovsky
Beginner
1,756 Views

I found a lead: changing /O* compiler option solved the issue.

     /O2 :  memory grows monotonously, as reported above.

     /Od : memory growth is reasonable (please see the attached file)

I'm wondering if I am missing something important, or if this is a bug in the compiler...

 

Anyway, I need a more practical solution (other than using /Od option forever),

since  /Od option slows down the application compared to /O2.

0 Kudos
NoorjahanSk_Intel
Moderator
1,702 Views

Hi,


We are working on your issue. We will get back to you soon.


Thanks & Regards,

Noorjahan.


0 Kudos
baranovsky
Beginner
1,674 Views

Hi Noorjahan,

 

I'm glad to hear that. thank you!


If it takes long to fix and you have any workaround for this issue, could you share the workarounds?

Because compile-with-/Od did not work for my project ...

0 Kudos
clevels
Moderator
1,584 Views

Hello Shoeji - I have been looking at this issue. It has been reproduced, and I have gone ahead and filed a ticket on this directly with the development team. I will provide you updates as soon as development takes a look at this. Thank you for your patience.


0 Kudos
clevels
Moderator
1,349 Views

Hello- there has been an update from the development team. With the oneAPI 2022.1.0 compiler they are seeing the following memory consumption graph using massif, which seems to be in line with what is expected:


If you are still able to reproduce this issue with the latest version, could you please provide detailed steps (compilation and run commands) along with the compiler and OpenCL CPU runtime versions?


run commands for above graph:

$dpcpp test.cpp

$valgrind --tool=massif ./a.out



0 Kudos
baranovsky
Beginner
1,337 Views

Thank you for the update!

I've confirmed that the memory growth issue seems to be solved on 2022.2.

As well as the code above, my application does not have the memory problem anymore!

0 Kudos
Reply