Page 1 of 3 123 LastLast
Results 1 to 15 of 43

Thread: Multicore CPU question for the IT types

  1. #1
    Join Date
    31st March 2003 - 13:09
    Bike
    CBR1000RR
    Location
    Koomeeeooo
    Posts
    5,559
    Blog Entries
    9

    Multicore CPU question for the IT types

    I'm coding an app that is going to do some heavy maths. Nothing complex - just lots of it.. again and again and again and... you get the idea.

    Now I have the option of getting a box with a multi-core CPU or a faster single core CPU for a given price.

    Dumb arse questions...
    1) Do I need to do anything in the code (VB6... yes yes ys... old...!) to take advantage of multicore
    2) Assuming multicore advantages can be gleaned, what's the speed boost? Is it 2x (i.e. 2 cores both processing) or is there something more I need to know?

    Ta.
    $2,000 cash if you find a buyer for my house, kumeuhouseforsale@straightshooters.co.nz for details

  2. #2
    Join Date
    3rd July 2003 - 12:00
    Bike
    Scorpio, XL1200N
    Location
    forests of azure
    Posts
    9,398
    Your app will not take any advantage of multiple processors (whether a 'multi core' CPU or actual multiple CPUs) unless it is written to be multithreaded.

    I'm guessing that it currently isn't.

    Writing a math program to compute results in parallel and thereby take advantage of multiple CPUs, regardless of the simplicity of the computations involved, is a non-trivial job. If you're keen to learn how, say the word and I can give you an hour or two in front of a whiteboard that should start you down the right path.

    It's good fun.
    kiwibiker is full of love, an disrespect.
    - mikey

  3. #3
    Join Date
    6th December 2004 - 15:55
    Bike
    a blue one
    Location
    on the 5th floor
    Posts
    511
    1) I don't know about VB6, but I would expect you will have to start muliple threads to get any benefit multiple cpu's. Can you get hold of a multiple core machine to experiment on? Then you would know for sure.

    2) the speed boost will not be 2x, there is an overhead cost to get multiple cpu's working together. Maybe 1.7x or thereabouts?

  4. #4
    Join Date
    5th August 2005 - 14:30
    Bike
    Various
    Location
    Auckland
    Posts
    4,359
    Quote Originally Posted by ManDownUnder View Post
    I'm coding an app that is going to do some heavy maths. Nothing complex - just lots of it.. again and again and again and... you get the idea.

    Now I have the option of getting a box with a multi-core CPU or a faster single core CPU for a given price.

    Dumb arse questions...
    1) Do I need to do anything in the code (VB6... yes yes ys... old...!) to take advantage of multicore
    2) Assuming multicore advantages can be gleaned, what's the speed boost? Is it 2x (i.e. 2 cores both processing) or is there something more I need to know?

    Ta.
    You will only run a single thread on a single core i.e. unless you pass the computational stuff out to another thread there would be no direct benefit to your app having a second CPU (or core).

    What would your app be doing whilst the computational stuff is running? If the answer is waiting then again, why put it into a second thread, the original one would just wait anyway.

    Unless you are familiar with multi threading they can add a lot of complexity, that said, like anything there are some tricks.

    If however your calcs can be split and/or the application has other work it can continue with whilst the calcs are being run it may be worth the extra complexity.

    Personally I would however tend toward the multi core CPU anyway. This allows the OS and it's services etc to use one core whilst you utilise the second. The OS will automatically take care of this for you.

    Architecture would play a huge part in any speed gain that a straight answer would be impossible with the info you have given, however no way would get half.

    Best results would be gained from experimenting and optimising the calc - you would be surprised at the tricks that can save time in a loop or repetitive calc.

    Next best may be to research the math co-processor and choose the CPU with the quickest math processor.
    Quote Originally Posted by Tank
    You say "no one wants to fuck with some large bloke on a really angry sounding bike" but the truth of the matter is that you are a balding middle-aged ice-cream seller from Edgecume who wears a hello kitty t-shirt (in your profile pic) and your angry sounding bike is a fucken hyoshit - not some big assed harley with a human skull on the front.

  5. #5
    Join Date
    3rd July 2003 - 12:00
    Bike
    Scorpio, XL1200N
    Location
    forests of azure
    Posts
    9,398
    Quote Originally Posted by The Stranger View Post
    ... choose the CPU with the quickest math processor.
    ... unless he's doing integer arithmetic.

    One way or t'other, his problem is bound to be parallelisable via the 'parcel assignment' paradigm, with multiple threads each working on a segment of the input range. It's easy to see that applying that approach to a long computation on a dual-core computer will halve running time. It's worth implementing the program that way if possible.
    kiwibiker is full of love, an disrespect.
    - mikey

  6. #6
    Join Date
    4th December 2006 - 13:45
    Bike
    2008 KTM SuperDuke R
    Location
    Brisbane, Queensland
    Posts
    1,010
    The ten commandments of VB6:

    1) Any programs thou shalt write shalt be have one thread and only one thread.
    2) ... 10) Don't matter.

    If it's in VB6, you cannot take advantage of multiple threads. Therefore, the best option is a fast single-core CPU. Though as someone else pointed out, multi-core will give you guaranteed CPU time for the operating system to take advantage of.

  7. #7
    Join Date
    9th November 2005 - 18:45
    Bike
    2005 Z750S
    Location
    Wellington
    Posts
    1,136
    I hear the cool kids are using their GPU's to do some of their maths - the video people are even helping: http://arstechnica.com/news.ars/post/20070219-8878.html

    VB6?

    Download C# Express.

    Now.
    Measure once, cut twice. Practice makes perfect.

  8. #8
    Join Date
    3rd July 2003 - 12:00
    Bike
    Scorpio, XL1200N
    Location
    forests of azure
    Posts
    9,398
    Quote Originally Posted by Sanx View Post
    The ten commandments of VB6:

    1) Any programs thou shalt write shalt be have one thread and only one thread.
    Today's refutation of Sanx's assertion is brought to you by the VB6 'AddressOf' operator and the Windows API 'CreateThread' function.



    Personally, I never use VB unless I absolutely have to. VB.NET addresses a lot of the shortcomings of VB6, though; perhaps MDU might like to upgrade his development environment and learn the new class hierarchy?
    kiwibiker is full of love, an disrespect.
    - mikey

  9. #9
    Join Date
    12th September 2003 - 12:00
    Bike
    Katana 750, VOR 450 Enduro
    Location
    Wallaceville, Upper Hutt
    Posts
    5,521
    Blog Entries
    26
    How did you find the transition from VB to VB.net Dan?

    We're currently still using VB6 at work.
    And I to my motorcycle parked like the soul of the junkyard. Restored, a bicycle fleshed with power, and tore off. Up Highway 106 continually drunk on the wind in my mouth. Wringing the handlebar for speed, wild to be wreckage forever.

    - James Dickey, Cherrylog Road.

  10. #10
    Join Date
    24th September 2006 - 02:00
    Bike
    -
    Location
    -
    Posts
    4,736
    As above, does VB6 even support threads? I wasn't aware it'd changed much since Microsoft BASIC 1.0 on the Apple II...

    Learn C, or at least C++, then you can do some real work. You don't use vicegrips to tighten your cylinder head bolts, and neither should you use silly toys for coding anything non-trivial. If it's so CPU-bound, you'll probably want something low-level like C so you can perform some basic optimisation (and use a compiler that makes nice assembly), I would doubt the VB6 `compiler' is any good (or is it just a glorified interpreter like .NET/Java? Yes I know about JIT, but still...).

    Yes you'll need to learn threading. Welcome to the world of locks and race conditions. It can be a brain-fuck, but that's why I went to university (not the University of Life, see other thread ).

    Get multicore anyway -- that's where consumer stuff is moving to anyway, so you'll be a little more future-proof. There's a lot of work going on right now to re-write stuff to take advantage of multiple cores.

  11. #11
    Join Date
    31st March 2003 - 13:09
    Bike
    CBR1000RR
    Location
    Koomeeeooo
    Posts
    5,559
    Blog Entries
    9
    Cheers you guys. Dan, Noel - FYI I'm a hack at programming so learning new hierarchies etc in .NET might be something to do in time, but fiurst I simply have a ton of numbers to download and anal-ize.

    Looks like I'm gettin' me a high speed single threaded CPU. I could parallel process in the future - y'know - getting another box and sitting it next to the first one

    Thanks all.

    Seriously though. Yes to .NET when I'm done doing this maybe... but that's a wee way away. This tool does the job, I know it well enough to do what I want so I'll stick with it rather than change mid project.
    $2,000 cash if you find a buyer for my house, kumeuhouseforsale@straightshooters.co.nz for details

  12. #12
    Join Date
    3rd July 2003 - 12:00
    Bike
    Scorpio, XL1200N
    Location
    forests of azure
    Posts
    9,398
    Quote Originally Posted by riffer View Post
    How did you find the transition from VB to VB.net Dan?

    We're currently still using VB6 at work.
    I've never done a .NET project. Been through the required tinkering with the .NET class hierarchy, realised that Hejlsberg essentially just recreated the Borland VCL, etc, but never had cause to use the .NET framework in an actual commercial endeavour.

    My last major software project (acoustic testing system) used a VB6 framework with the guts implemented in C++ and embodied in ActiveX controls, and I'm currently using non-.NET C++ to write COM classes extending a large commercial software product.

    I did consider porting the aforementioned acoustic testing system to .NET, but cost/benefit never looked worthwhile. Although I'm afraid I must admit that by the time I left that company, development on the system had essentially plateaued, and I was on the verge of having to justify my salary with pseudo-commercial bullshit around the Big .NET Port (tm) being a crucial R&D investment.

    I've always strongly suspected that money gets burned that way more often than many CEOs and boards realise...
    kiwibiker is full of love, an disrespect.
    - mikey

  13. #13
    Join Date
    3rd July 2003 - 12:00
    Bike
    Scorpio, XL1200N
    Location
    forests of azure
    Posts
    9,398
    Quote Originally Posted by xerxesdaphat View Post
    As above, does VB6 even support threads?
    Yes. Perhaps I was too oblique before. You can take the address of VB6 functions via 'AddressOf' and feed that into the Windows multithreading API to write threaded applications.

    Basically it involves a lot of bullshit and verbiage in the code to make it do what you should have been using C++ for in the first place, but it's entirely possible and works just fine.
    kiwibiker is full of love, an disrespect.
    - mikey

  14. #14
    Join Date
    25th April 2006 - 15:56
    Bike
    Gerbil DNA 180
    Location
    Auckland
    Posts
    277
    If you are doing heavy math, stay away from OOP. VB6 is about as unsuitable for math apps as say SQL or LISP.
    The best language that gives you benefits of parallel CPUs is C (C++ is easier to code but the overhead is too big and the way I see it you need all the performance you can lay your hands on), but *IF* and only if you can change the algorithm to benefit from parallelism (usually some tricky math involved) and you have balls to deal with the troubleshooting. (I've spent some time debugging some code written in ParC back at school and it was a nightmare).
    If calculations are really heavy the best approach is a distributed seti@home style application.
    Just my NZ$0.02
    "People are stupid ... almost anyone will believe almost anything. Because people are stupid, they will believe a lie because they want to believe it's true, or because they are afraid it might be true. People's heads are full of knowledge, facts, and beliefs, and most of it is false, yet they think it all true ... they can only rarely tell the difference between a lie and the truth, and yet they are confident they can, and so all are easier to fool." -- Wizard's First Rule

  15. #15
    Join Date
    3rd July 2003 - 12:00
    Bike
    Scorpio, XL1200N
    Location
    forests of azure
    Posts
    9,398
    Quote Originally Posted by Street Gerbil View Post
    The best language that gives you benefits of parallel CPUs is C (C++ is easier to code but the overhead is too big...
    How do you think using C++ would slow down a mathematical computation program?
    kiwibiker is full of love, an disrespect.
    - mikey

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •