• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Multi Processors in Ruby

Scheduled Pinned Locked Moved Developers' Forum
9 Posts 3 Posters 1.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    Al Hart
    last edited by 12 May 2008, 19:12

    I was just explaining to a client why SketchUp is slower on his new Quad machine than on his old single core machine. I'm sure I didn't have it right - but I assumed that each on of the 4 processors on the new machine is slower then the single processor on his old machine, and that SketchUp can only use one processor. Does that seem logical.

    Here is the real question for this thread. If I use UI.timer to start new threads in Ruby, is it possible that I might be able to do things in SketchUp in parallel (under tightly controlled circumstances - such as having each of two fetch data from every-other entity in the drawing. Has anyone ever tried this?

    It seems like if we could write some special multi-threading tools in Ruby we could help SketchUp survive in the multi-processor world??? (As a CAD developer I know there are many things you cannot do - such as having both threads change the drawing at the same time, but there are other things which might be possible - especially when searching or extracting data)

    Al Hart

    http://wiki.renderplus.com/images/e/ef/Render_plus_colored30x30%29.PNG
    IRender nXt from Render Plus

    1 Reply Last reply Reply Quote 0
    • A Offline
      AdamB
      last edited by 13 May 2008, 18:42

      I think I'm right in saying that Ruby doesn't support placed processes/threads. ie Its threading is just a very simple scheduling within the process in which it was spawned. So you get no performance gain by threading within Ruby.

      Adam

      Developer of LightUp Click for website

      1 Reply Last reply Reply Quote 0
      • T Offline
        tbd
        last edited by 13 May 2008, 19:11

        funny thing - I did a Test.time_display 1000 on my quadcore and all 4 core are used by Sketchup process

        SketchUp Ruby Consultant | Podium 1.x developer
        http://plugins.ro

        1 Reply Last reply Reply Quote 0
        • A Offline
          AdamB
          last edited by 13 May 2008, 19:52

          Yes, expected behaviour. A task will be farmed out to 'a core' - any core.

          But you can't place processes on processors/cores and therefore you don't get true concurrency. 😞

          Adam

          Developer of LightUp Click for website

          1 Reply Last reply Reply Quote 0
          • A Offline
            Al Hart
            last edited by 13 May 2008, 19:56

            @unknownuser said:

            funny thing - I did a Test.time_display 1000 on my quadcore and all 4 core are used by Sketchup process

            But did you ever get SketchUp to use more than 25% of the total processor time? (with 4 cores)

            Al Hart

            http://wiki.renderplus.com/images/e/ef/Render_plus_colored30x30%29.PNG
            IRender nXt from Render Plus

            1 Reply Last reply Reply Quote 0
            • T Offline
              tbd
              last edited by 13 May 2008, 20:06

              Adam: I put SU on core 0 and 3 and both cores were running at 85-95%

              Al: max was 45% on all 4 cores

              SketchUp Ruby Consultant | Podium 1.x developer
              http://plugins.ro

              1 Reply Last reply Reply Quote 0
              • A Offline
                AdamB
                last edited by 13 May 2008, 22:02

                Don't confuse the real threads within an Application and the Thread objects in Ruby. We're speaking of the latter here.

                I could easily believe that SU has a bunch of threads doing stuff that if given the opportunity will be placed by the scheduler on different cores - hence the result you're seeing TBD. The original question was about leveraging cores from Ruby.

                However, the broader issue of making SU use multi-core machines in a scaleable way (ie double the cores, roughly double the performance) is tricky because I suspect much of what SU does internally doesn't parallelize very well. Be interesting to know where the time in SU goes...

                And the even broader issue is that in software engineering generally, we're still using the same old patterns for much of our codebases that simply doesn't fit well with a platform with many cores - much of what we do is very procedural - invoke a function, get an answer - which is just not how these platforms want to be driven. (They want more the flavor of here's 50 calls to that function and I'll pick up the answers sometime later).

                How you gonna map SU to Larabee, Mr. Sketchup? 😄

                Adam

                Developer of LightUp Click for website

                1 Reply Last reply Reply Quote 0
                • A Offline
                  Al Hart
                  last edited by 13 May 2008, 22:14

                  I suspect I'm just going to have to try this when I get a chance.

                  One of the reasons that a CAD system like SketchUp has a hard time using multiple cores, is that you can only assign tasks to multiple cores when there are two (or more) tasks you can do at the same time.

                  In our rendering engine, we can process rendering for one horizontal scan line in one task, while we are processing pixels in the next scan line in another task.


                  A similar example in a CAD system would be for reading through the drawing.

                  For instance if you were searching for something in the model which took an appreciable amount of time, you could search half the entities in one task and the other half in another task.

                  But this gets much trickier if you are searching and modifying at the same time, because now you would be modifying the drawing, and this might make things difficult for the other task (if anything internally gets changes or moved).

                  I was just interested in:

                  1. Is it possible to access the sketchup database separately from multiple tasks in Ruby

                  2. If so, can we think of any task which takes a lot of time which we could speed up.

                  Of course, it would be even better if the SketchUp development team would try to see what things they could multi-task. But, while we are waiting, perhaps the "ruby" crew could think of some ideas.

                  Al Hart

                  http://wiki.renderplus.com/images/e/ef/Render_plus_colored30x30%29.PNG
                  IRender nXt from Render Plus

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    AdamB
                    last edited by 13 May 2008, 22:18

                    @al hart said:

                    I was just interested in:

                    1. Is it possible to access the sketchup database separately from multiple tasks in Ruby

                    Ruby doesn't 'do' concurrent tasks. So the answer is No!

                    Adam

                    Developer of LightUp Click for website

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    1 / 1
                    • First post
                      1/9
                      Last post
                    Buy SketchPlus
                    Buy SUbD
                    Buy WrapR
                    Buy eBook
                    Buy Modelur
                    Buy Vertex Tools
                    Buy SketchCuisine
                    Buy FormFonts

                    Advertisement