Multithreading and partitioned shared memory

Hi all

I'm having no success with this problem multithreading (simple?) on my processor core-i7, using CVI 9.0 (32-bit compiler).

In the snippets below, I have a structure of node 5 integers, and I use 32 calls to calloc() to allocate space of 32 blocks of 128 * 128 nodes (16K) and store pointers returned in a table as a global var.

Size in bytes of the nodes = 20, size in bytes of the block = (roughly) 328KB, total allocated size in bytes = (roughly) 10.5 MB.

I have then spawn 32 threads, each of them is passed a unique index in the pointer_array of 'node_space' (see code below), kind, each thread handles (read/write) a block separated from K 16 knots.

It must be thread-safe and multiply by the number of threads because each thread is addressing a different memory block (with no overlap), but not multithreading go more quickly (maybe a little) to a single thread.

I tried different sizes of thread pool, filling of the nodes to the limits of 16 to 64 bytes, all to nothing does not.

Is this a problem of band bandwidth memory due to the size of the tables? Each thread is somehow loaded the whole 32 blocks?  Any help appreciated.

struct node

{
unsigned int a;
unsigned int b;
unsigned int c;
unsigned int d;
unsigned int e;

} ;
typedef struct lymph nodes;
typedef nodes * Node_Ptr;

Node_Ptr node_space [32];          / * pointer to table in 32 separate blocks (loaded via individual calloc calls for each block) * /.

.... Spawning wire...

for (index = 0; index)< 32;="">

CmtScheduleThreadPoolFunction (my_thread_pool_handle, My_Thread_Function, & index, NULL);

Hello CVI_Rules,

It is difficult to answer your question because it depends on what you do in your thread function. Given that you do not see any speed upward in your program when you change the number of threads in your thread pool, you are done as well (or all the work) in each thread, serialize your threads with locks, or somehow slow down execution of each thread.

Your basic configuration seems fine. You can simplify it slightly by moving the nodes directly to your thread function:

    for (index = 0; index < 32; ++index)
    {
        CmtScheduleThreadPoolFunction(pool, My_Thread_Function, node_space[index], NULL);
    }

...

static int My_Thread_Function(void *functionData){    Node_Ptr nodes = functionData;...

But this will not affect performance.

Things to look at:

  1. Check that you're really work only on a subset of node space in each thread, you are passing and receiving the correct node space in each thread and you work only on that one.
  2. Verify that you do not have locks or other synchronization in your program. It seems that you do not have because you have designed your program so that it would not need any. But check anyway.
  3. Check that you do not have something useless in your thread function. Sometimes people call ProcessSystemEvents or ProcessDrawEvents because they feel that it makes the user interface more responsive. These two functions are expensive (all about 20 ms per call, I think). So, if you call these functions in a loop, with a fixed number of iteraction on all threads, and if the actual calculations are relatively fast, then these functions can easily dominate the runtime of your program. (There aren't necessarily those functions, it may be others. "These are just examples).
  4. Show and explain your code to a colleague. Sometimes, you don't see clearly until you show someone. Or they may have noticed something.

Apart from this, can you explain what you are doing in your thread function so that we can have a better understanding of your program and what might inhibit parallelism?

Tags: NI Software

Similar Questions

  • Premiere Pro, After Effects CS5 and the shared memory pool

    This feature works fine in Win 7 x 64. I think adding more RAM and going up to 12 GB. However, I noticed that CS5 sharing memory pool is limited to 75% of the physical RAM installed. Even if that makes sense, if you have a computer with the minimum requirements of 4 GB (because Windows itself will use a little less 1 GB + /), it makes less sense to 12 GB, where 9 GB is all you can use for the pool of CS5.

    Is this the way it works, or is it possible that I can be 'greedy' and go the number of 75% for larger amounts of physical RAM? It helps to have as physical RAM as much as possible for AE previews high resolution, etc..

    It is by design.

  • ESXi Shared memory of commom and UCS B200M2

    I vSphere 4.x environment to IBM 3650 and half B200M2 (a group consisting of the 3650 and a group consisting of the B200M2).  IBM machines are 2 socket quad core with 34 GB of memory and Cisco are 2 Socket 6 core with 48 GB of memory.  Workloads on IBM and Cisco ESXi hosts are the same.  For most of 2008 and Windows 2003 machines.  On IBM machines, I move 1 GB, 2 GB of shared memory (common shared memory - amount of memory that is shared by all virtual machines powered and vSphere services on host machine) on each ESXi host.  On Cisco machines, I get around 15 MB on each ESXi host. Considering that it is one of the great features of VMware (sharing of memory) why is there such a huge disparity between the machines?  Is it because the Cisco blades NUMA machines?  Is there a setting I'm missing?  It's a huge difference.  I don't regret getting the UCS stuff I like it but it is the big novelty of the VMware that does not work with the UCS.

    Please take a look at the following:

    http://KB.VMware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalID=1020524

    Transparent Page Sharing on the Nehalems won't be out until the memory usage is almost 100%.

    Edit: should read: Transparent Page Sharing on the Nehalem and later generations will not kick until the memory usage approaches 100%.

  • Satellite Pro C660 - 21 d - how to change the shared memory graphic value?

    My dxdiag screen says I have almost 1700 MB of video memory, but when I try to use this memory on games these games can use 256 MB...

    I tried to change settings in the BIOS, but it does not have this setting, do not know what else could cause this problem?

    Hello

    This could be confusing, but this isn't a problem.
    Shared memory is controlled by the graphics driver and the driver affects the part of the main memory to the memory of the graphics card ONLY if its required by a running application.

    The Dxdiag shows you how much RAM could be shared and value of memory in the quizzes you shared memory which is used and who is in the game right now.

  • Satellite A300D-126 - how to set shared memory?

    Hello!

    A month ago I bought 4 GB of RAM (2x2gb) and I got Windows 7 as operating system.
    My RAM memory is automatically extended to my grafic card (from 256 to more than 1,500 then) and everything worked fine...

    As I could not find the driver for the camera for Win 7, I decided to go back to Win XP and so I did.
    Now, my graphics card is 256 MB and memory system 3.25 GB of RAM. All my drivers are up to date.
    I don't know how to set up shared memory...

    In the BIOS there is no option for it, and I can't update the BIOS when I download the new version...

    Please give me an idea to try out! ... TNX!

    [Photo: http://img523.imageshack.us/img523/4298/94564415.jpg]

    Hello!

    The reason why you can use the entire 4 GB of RAM of the t is the reason why you are using Windows XP or let's say a 32 bit OS. On 32 bit OS it is limitation of memory and so t may be used more than 3.25 GB of RAM. If you want to learn more about this limitation please read this article:
    http://APS2.toshiba-tro.de/KB0/TSB82022E0000R01.htm

    Furthermore there is no BIOS option to set the graphics memory. It also depends on the limit of 4 GB and the size of the graphic RAM will solve automatically.

    Good bye

  • Change the shared memory in the Bios for the graphics - Satellite C660 217

    There is no setting in the BIOS that I can find.

    BIOS is up to date

    Hello

    It is not possible.

    Shared memory is assigned automatically and this is controlled by the graphics driver.
    But the shared memory is only used if the applications (IE game) would require more graphics RAM.

  • Satellite Pro L850 - i5 3210 M shared memory allocation

    Hello

    I am a happy owner of this laptop great and I added an extra RAM to consider to 8 GB.

    All data sheets on the State of sites detailing the gpu that can be assigned up to 1.7 GB of memory share.

    Previous experience from other computers is that this amount of memory is impaired in the BIOS settings, but I don't see any option in the latest BIOS 1.60.

    Obviously theres a lot of RAM to give to the GPU, but I do not see how to assign. The i5 chips allocate dynamically once Windows is running or the BIOS is missing this setting?

    Thanks in advance for any help.

    Hello

    Shared memory is controlled by the graphics driver and it cannot be controlled manually if running applications needs some shared memory, the pilot would have set this value automatically.

  • Satelite C670-1DW: how to increase shared memory?

    How to increase shared memory for display from 64 MB to 512 MB?

    Hello

    It is not possible.
    You cannot change the value manually the graphic card driver controls cela and it changes automatically.
    In addition, your laptop supports an internal graphics Intel HD (HM55) card and this chip is not really suitable for the game.

  • Satellite L650-16W: how to change the GPU shared memory

    Hi all

    I have a question about my L650-16W:

    How can I set the size of the memory shared of the ATI Mobility Radeon HD 5650?

    I look at my system bios, but it seems that it is not possible to define the shared memory...

    > I watch my system bios but it seems that it is not possible to define the shared memory...
    You are right. It is not possible.
    You cannot change the value manually... it s controlled by driver graphics card and everything works automatically.

  • Satellite L300D-10B: how to increase shared memory?

    Hi, I have a noob question q :)

    I use XP Professional.
    My L300D-10B, using the Videocard ATI Radeon X 1200 Seris with 800 MB shared memory, but the work on 128.
    I have a question; How can I up to 256? There were just 800?
    I have 2 GB of RAM and I think that can up to 256, but how?

    I chek the bios, but not found anything with this stuff...
    I am from Bulgaria if Bulgarian too may have to help me or if not some tell me...

    A man told me things for some Toshiba KEY... to unlock an option in my bios I send emails but...
    And if do made 256 will have a good effect specialty for the games or not?

    It's all thanks. :]

    Hello!

    If you now 800 MB shared memory, you have quite 928 MB memory graphics.

    A dedicated video memory 256 MB upgrade is not possible because the graphics card is soldered on the motherboard and t can be exchanged. Who you mans can only increase the total available graphics memory, with more RAM.

    Good bye

  • Satellite A300 - can I work without shared memory?

    * I want to work with my A300 without shared memory! *
    * I can or not? *
    * and Toshiba a Notbook product, it has no shared memory? *

    > Toshiba has a Notbook product, it has no shared memory?
    Of course. A lot of them.

    Shared memory is controlled automatically.

  • Satellite P300-156 - ATI 3470 256 MB - low shared memory

    I need solution.
    I see now my system properties 4 GB of ram available.
    2 months ago I had only 3 GB of free because 1 GB GB for like shared memory graphics card.

    Can anyone help me solve this problem, because after this update problem, I've got 4.5 system score and now I have only 4.
    Where is the problem, something with drivers or what? Sorry for the English.

    Need help to solve this problem

    Hello

    Shared memory cannot be assigned manually.
    Everything is controlled by the graphics card driver it assigns and automatically share memory to graphics card memory

    Memory will be affected ONLY if it of necessary it means that if running applications n t need more graphics memory then the graphics card driver not be assigned more than necessary!

  • Satellite L40-170: Video shared memory question

    Hello

    I use Windows XP and most of the time that I have more than enough free RAM.

    I wanted to know where I can see how much memory is allocated for the process of video and possibly increase it?

    Thanks in advance!

    Hello

    As far as I know the graphics driver automatically assigns the shared memory.
    You have the Intel GL960 GPU. I'm wrong

    In this case the Intel reader control shared together memory and you will not be able to manually change

    Best regards

  • XP Pro SP 3 firewall blocking UDP 137 and 138 even though exception "File and Print sharing" is selected

    I am running XP Pro SP 3 on a working group. I'm trying to access the files from a Windows 7 machine on the same workgroup. But the XP firewall blocking UDP 137 and 138 even though exception "File and Print sharing" is selected. When I disable the XP firewall, all right.

    Here are a few entries in the firewall exception log file:

    2012-06-01 09:53:25 DROP UDP 192.168.2.190 192.168.2.255 137 137 78 - RECEIVE
    2012-06-01 09:53:26 DROP UDP 192.168.2.190 192.168.2.255 137 137 78 - RECEIVE
    2012-06-01 09:53:27 DROP UDP 192.168.2.2 192.168.2.255 138 138 202 - RECEIVE
    2012-06-01 09:53:28 DROP UDP 192.168.2.190 192.168.2.255 137 137 78 - RECEIVE
    2012-06-01 09:53:28 DROP UDP 192.168.2.190 192.168.2.255 137 137 78 - RECEIVE
    2012-06-01 09:53:29 DROP UDP 192.168.2.11 192.168.2.255 138 138 202 - RECEIVE

    I did some research on another site, and I came up with the FIX for this issue. It has to do with the node XP somehow getting ready to type "Peer-to-peer". I applied the fix in this article:

    http://support.Microsoft.com/kb/903267

    and the problem is now solved.

    Please come back and let everyone know how you fixed the end!

    However, the fact that this has happened and you don't know how concerned me (if it was my machine).

    Here's what I propose for extra cleaning:

    Search for malware:

    Download, install, execute, update and perform analyses complete system with the two following applications:

    Remove anything they find. Reboot when necessary. (You can uninstall one or both when finished.)

    Search online with eSet Online Scanner.

    The less you have to run all the time, most things you want to run will perform:

    Use Autoruns to understand this all starts when your computer's / when you log in. Look for whatever it is you do not know usingGoogle (or ask here.) You can hopefully figure out if there are things from when your computer does (or connect) you don't not need and then configure them (through their own built-in mechanisms is the preferred method) so they do not - start using your resources without reason.

    You can download and use Process Explorer to see exactly what is taking your time processor/CPU and memory. This can help you to identify applications that you might want to consider alternatives for and get rid of all together.

  • problem with the creation of partition of memory not allocated to HP computer laptop

    I have HP Loptop with windows 7 operating system. In this 4 discs are here. ((1 C: 2). HP_TOOLS. 3) Recovery (D :)  (4) SYSTEM.

    from C: drive with about 445 gb, after shrink sound have 33.4 and 411 GB not allocated space...

    On the management of the computer, I made the following
         411 GB-> right click-> new simple volume-> next-> next-> next-> next-> finish.
    But after press the Finish button appears after the message.
    The operation you selected will convert the selected basic disks and dynamic disks. If you convert the dynamic disks, you will not be able to start installed operating from any volume on the disks (except the current boot volume). Are you sure you want to continue?
      
    I pressed the Yes"" button. Then I got a message like: dynamic disks are not supported by this operating system or the configuration of the server. Dynamic disks are not supported on the cluster.

    I have 5 HP recovery DVD
    Could you please help me to partition unallocated memory?

    · What are the existing partitions on your hard drive logical?

    Generally, a hard drive is configured with a primary and one extended partition. However, the extended partition can have up to 23 drive letters assigned to breast, for a total of 24 drive letters.

    There are three types of partitions: primary partitions,extended partitions , and logical drives. A disc can contain up to four primary partitions (only one of them can be active), or three primary partitions and an extended partition. In the extended partition, the user can create logical drives (i.e. "simulate" several small hard drives).

    Check out the links for more information:

    Create and format a hard disk partition: http://windows.microsoft.com/en-US/windows7/Create-and-format-a-hard-disk-partition

    http://social.answers.Microsoft.com/forums/en-us/vistaperformance/thread/bb1284e2-3fa4-472a-b3db-1777fb692525

Maybe you are looking for

  • Recommendations of power supply for P6774y

    I have a P6774y AMD Phenom II X 4 840 T I just installed a new Radeon 6870 and the computer keeps shut down during some games. Do you have recommendations for a compatible power? I thought maybe one of these Corsairs? It will be difficult to install?

  • CSS - webkit-filter does not

    Hello I am facing a little problem - I've defined a custom CSS filter using SVG, I can apply without problem on any element except - here he does not apply my custom filter while Webkit built-in filters such as blur(), sepia(), etc.. Anyway how to re

  • Access WiFi Limited, problem with Wifi adapter

    Original title: wifi access my laptop recently having limited wifi access issue. I tried troubleshooting, but it did not help. It comes up with a window saying there is a problem with my wireless card. I checked the wifi card in the Device Manager an

  • Table of contents and PDF bookmarks

    InDesign CC October 2015Windows 8.1I have created a table of contents, all styles, it seems good. The next step is to have the bookmarks actually export to a PDF file.I chose the option "create PDF bookmarks"; all created bookmarks in the Bookmarks p

  • Starburst effect CS6 reverse the effect / transition how?

    Hi allI'm stumped on how to reverse this effect, it starts Nill and ramps up to full. I would like to reverse this start to full and ramp to nothingness.I tried setting upwards as desired in reverse as it ' comes out of the box "then remapp in revers