Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Only 32% CPU usage

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    I have the same problem. I have 16 cores and 20 gigabytes of RAM and NT only ever maxes out at about 30% CPU usages, it usually hangs around the 13% range sadly.

    I have written quite a lot of multi threaded code in my time and I have the sneaking suspicion that the reason NT cannot breach 30% very efficiently on anyone's computers is because they have too many cross-thread shared resources (mutexes, semaphores, etc - anything that can be locked to create atomic access.) Even when its just for a millisecond here and there it adds up and the cores cannot ever get up to full load.

    ----

    My guess is that instead of saving the results inside each thread in their own private results list, then joining them up at the end; NinjaTrader is using a global result list across all the threads, access locked by a mutex, and each thread is storing the results of each run (while blocking the others via a mutex lock during this moment) creating a scenario where nobody can get above 30% usage because they are constantly getting into a blocking mutex lock (waiting for each other to write/read to the result list.) In this case results should be stored in the thread and only joined up into a global structure at the end.

    Man I kind of wish I had the NT code, I feel like a week cracking at it and I'd have it burning down my 16 core machine.

    ----


    This really should not be the case. If i was architecting NJ multi core support I would simply count the cores, divide up all the possible cases (when bruteforce method) by the number of cores, and blast through with only the occasional (i'm talking maybe once every 30 or 60 seconds) cross-communication to rebalance a core load if one finished early. This is how I implemented some computer vision pattern detection that churned away over 100s of hours of video and had Zero Problems keeping any machine fully loaded.

    It'll all about properly preparing your data so you don't need go fetch anything mid-computation, properly dividing it in a way that requires 99.99999% of the time the threads are completely independent of each other and require no cross communication. And using mutexes only very very rarely.

    I must repeat to great multicore code you must NEVER USE MUTEXES UNLESS ABSOLUTELY NECESSARY. If it can be done without a mutex it must be done that way. Mutex is just meant to mean any threadlocking structure.
    Last edited by volkie; 04-08-2012, 02:32 PM.

    Comment


      #17
      Volkie, your assessment makes complete sense to me. Of course, we can't know for sure without access to the source code, but having also had a fair bit of experience writing multi-core optimized systems I think everything you've said is spot on. There's simply no reason why every core shouldn't be getting pegged at 100% usage for most of the time during optimizations.

      For what it's worth, I'd like to add my vote for better multi-core performance being high on my list of desired features.

      Comment


        #18
        Forwarded feedback to development.

        For sure keep an eye out for our next major release, again there is no release date at this time however.

        Thanks guys.

        Comment


          #19
          grrrrrrrrr

          ok I just got finished building a new pc specifically for ninjatrader.
          watercooled 3960x overclocked to 5.0ghz 6 cores / 12 threads
          64gig 1600 ddr3 ram
          revodrive pci 3 x2
          watercooled amd 7970 with 6 x 27" eyefinity
          Windows system score 7.9

          And..... Im so excited....... but wait.....

          8.33 average cpu usage

          :|
          Last edited by darkspeed; 05-13-2012, 10:40 AM.

          Comment


            #20
            So play a game while waiting for NT to finish.



            Originally posted by darkspeed View Post
            ok I just got finished building a new pc specifically for ninjatrader.
            watercooled 3960x overclocked to 5.0ghz 6 cores / 12 threads
            64gig 1600 ddr3 ram
            revodrive pci 3 x2
            watercooled amd 7970 with 6 x 27" eyefinity
            Windows system score 7.9

            And..... Im so excited....... but wait.....

            8.33 average cpu usage

            :|

            Comment


              #21
              Originally posted by sledge View Post
              So play a game while waiting for NT to finish.

              Welll thanks for that idea.....

              What I dont understand is that my previous computer - 2 core 2.9ghz would peg and stay at 100% process for a long... long.. time sometimes crashing due to a total ram fill.

              So I would have guessed processor 0 would be near 100% on the new machine and the others would be idleish..

              Comment


                #22
                Well just tried a different optimize

                23% cpu usage.. seem to be using all 12 threads

                fills up the ram until it reaches around 30 gigs of the 64 available.

                I did notice in resource monitor that the status for ninjatrader.exe is [Not Responding] about 90% of the time rather than [Running] like all the other processes.

                its not newtork as i am on a 35mbs connection and its not disk lag as the pci revo is a ram drive.

                software
                Last edited by darkspeed; 05-13-2012, 12:03 PM.

                Comment


                  #23
                  Originally posted by darkspeed View Post
                  Well just tried a different optimize

                  23% cpu usage.. seem to be using all 12 threads

                  fills up the ram until it reaches around 30 gigs of the 64 available.

                  I did notice in resource monitor that the status for ninjatrader.exe is [Not Responding] about 90% of the time rather than [Running] like all the other processes.

                  its not newtork as i am on a 35mbs connection and its not disk lag as the pci revo is a ram drive.

                  software
                  "Not responding" just means that the messaging queue is not being hit. IOW that program is hogging the processor. I thought that that was what this thread was seeking, and cavilling about because the processor was not at 100%?

                  Comment


                    #24
                    Originally posted by koganam View Post
                    "Not responding" just means that the messaging queue is not being hit. IOW that program is hogging the processor. I thought that that was what this thread was seeking, and cavilling about because the processor was not at 100%?
                    Actually analyzing the wait chain shows multiple threads waiting to finish network i/o
                    Threads waiting in line to do something != productivity

                    Comment


                      #25
                      Originally posted by darkspeed View Post
                      Well just tried a different optimize

                      23% cpu usage.. seem to be using all 12 threads

                      fills up the ram until it reaches around 30 gigs of the 64 available.

                      I did notice in resource monitor that the status for ninjatrader.exe is [Not Responding] about 90% of the time rather than [Running] like all the other processes.

                      its not newtork as i am on a 35mbs connection and its not disk lag as the pci revo is a ram drive.

                      software
                      Sorry to re-bump an old thread, but I'm also facing the same problem with NT [Not Responding] the majority of the time during optimization. This doesn't start happening until about 5-6 hours in. Once it does though, NT appears to slow to a crawl, and I'm no longer sure if it hung or not ( I have an optimizer running for 5 days now ).

                      Does it matter if I'm using Amazon EC2 Cluster Compute? I'm running my Optimizers on a cc2.8xlarge instance , which is basically 88 CPU units, 16 cores, and 60.5 GB RAM. Granted, I'm running my optimization on a 600+ stock list stretching back to 1/1/2009 , 15 min timeframe, but even testing a single variable change in 4 jumps can take multiple hours.

                      -N

                      Comment


                        #26
                        Multi-Core Update?

                        Sorry to bump an old thread, but what's the latest on NT's multi-core capabilities?

                        Was NT able to address the issues identified by Volkie (post #16) and DarkSpeed?

                        Thanks,

                        Aventeren

                        Comment


                          #27
                          Hello Aventeren,

                          Thank you for your post.

                          Multi-Core is planned for the next major release of NinjaTrader. There have been no changes to the multi-threaded capabilities of NinjaTrader 7.

                          Comment


                            #28
                            Hello,

                            Thanks for the bump.

                            Would like to let you know that you will be excited for NT8 as the optimizer was "optimized" to use near 100 % CPU on all cores now in NT8. Users that run heavy optimizations will have a lot of reasons to update to NT8 when it is released. I don't have a release date yet I could give out and we will only release it when its ready. Would like to let you know though if you havn't already please email into support at ninjatrader dot com and ask to be added to the internal beta list to get earlier access and reference this forum post. Would love to get your feedback on NT8.

                            -Brett

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by burtoninlondon, Today, 12:38 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post burtoninlondon  
                            Started by AaronKoRn, Yesterday, 09:49 PM
                            0 responses
                            12 views
                            0 likes
                            Last Post AaronKoRn  
                            Started by carnitron, Yesterday, 08:42 PM
                            0 responses
                            11 views
                            0 likes
                            Last Post carnitron  
                            Started by strategist007, Yesterday, 07:51 PM
                            0 responses
                            13 views
                            0 likes
                            Last Post strategist007  
                            Started by StockTrader88, 03-06-2021, 08:58 AM
                            44 responses
                            3,982 views
                            3 likes
                            Last Post jhudas88  
                            Working...
                            X