octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #64687] mxMalloc thread safety and mxCreateNum


From: anonymous
Subject: [Octave-bug-tracker] [bug #64687] mxMalloc thread safety and mxCreateNumericArray performance
Date: Mon, 18 Sep 2023 00:41:09 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?64687>

                 Summary: mxMalloc thread safety and mxCreateNumericArray
performance
                   Group: GNU Octave
               Submitter: None
               Submitted: Mon 18 Sep 2023 04:41:07 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 8.3.0
         Discussion Lock: Any
        Operating System: GNU/Linux
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Mon 18 Sep 2023 04:41:07 AM UTC By: Anonymous
I have been working on a mex function recently that uses OMP threads. It works
fine in Matlab but gave a lot of mysterious crashes, and was relatively slow
in Octave. I think I narrowed it down to 2 issues (bugs perhaps?):
1. mxMalloc/mxFree are not thread safe in Octave (replacing them with
malloc/free works)
2. mxCreateNumericArray (initialized with zeros) is significantly slower than
mxCreateUninitNumericArray.
I'm attaching a short demo code (TestFunc.cpp). Matlab is much faster in this
example but not so much when there is work to do in the loop.

*WARNING: creates an 8Gb array*

In MATLAB:
>> tic;TestFunc(1000,0);toc
Elapsed time is 0.787033 seconds.
>> tic;TestFunc(1000,1);toc
Elapsed time is 0.866709 seconds.

In Octave:
>> tic;TestFunc(1000,0);toc
Elapsed time is 11.4068 seconds.
>> tic;TestFunc(1000,1);toc
Elapsed time is 6.91305 seconds.








    _______________________________________________________
File Attachments:


-------------------------------------------------------
Date: Mon 18 Sep 2023 04:41:07 AM UTC  Name: TestFunc.cpp  Size: 945B   By:
None

<http://savannah.gnu.org/bugs/download.php?file_id=55143>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64687>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]