Author Topic: Run multiple program instances in parallel  (Read 13381 times)

Offline Ender46

  • Single posting newcomer
  • *
  • Posts: 2
Run multiple program instances in parallel
« on: February 01, 2010, 07:24:10 pm »
Hello all,

Recently I decided to upgrade my programming environment for my short c++ scripts from gedit to Code::Blocks. Needless to say, the difference is abismal. I have however found something that is annoying me, and that I know has to have a very easy fix, but I can't seem to find it.

I'm running version 8.02, in a Karmic Ubuntu, with an i7 920 processor (2.66GHz). When I used to work in the ancient manner, writting the code in gedit and compiling it with g++ from the command line, I could call the produced binary file multiple times, and each instance would use its own independent thread, so I could take advantadge of the multithreading capacities of my computer (given that I'm completely unable to make the program use multithreading by itself). However, when I compile the exact same code using Code::Blocks, whenever I call the binary multiple times, all the instances will just queue up on the same thread, effectively making things 8 times less efficient.

How can I solve this? Thanks in advance

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Run multiple program instances in parallel
« Reply #1 on: February 01, 2010, 08:20:23 pm »
How can I solve this? Thanks in advance
You can easily use the tools menu for that. Use the macros to point to the currently active target and then assign the launch command (with console, if you like) to run "visible, detached". Thus whatever target is active you can run multiple times from the menu therefore.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Seronis

  • Almost regular
  • **
  • Posts: 197
Re: Run multiple program instances in parallel
« Reply #2 on: February 02, 2010, 12:26:33 am »
Can tips like that get put in the Tip of the Day window?  =-)  Also i think  'full commandline output' needs to be tip #2.  I think its currently last.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Run multiple program instances in parallel
« Reply #3 on: February 02, 2010, 08:33:44 am »
Can tips like that get put in the Tip of the Day window?  =-)  Also i think  'full commandline output' needs to be tip #2.  I think its currently last.
We have a very nice documentation that explains all that in detail. Hence nobody is reading. :-( So I'd say the tooltips will nobody read, too (in fact it's the first thing I disable when running a new software).
You can't defeat laziness, can you?!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Ender46

  • Single posting newcomer
  • *
  • Posts: 2
Re: Run multiple program instances in parallel
« Reply #4 on: February 02, 2010, 12:42:37 pm »
Ok, after having spent a couple of hours on this, it seems I have it working now.

For the record, since my scripts requiered input from the console and showed meaningful output on it, I had to create a tool that would execute
gnome-terminal -x ${TARGET_OUTPUT_FILE}
from the working directory
${PROJECT_DIR}
with launching mode visible and detached. What this efectively does is to execute your current active binary in a new console terminal, which seem to be thread-independent at least to some extent.

Thanks!

Offline Seronis

  • Almost regular
  • **
  • Posts: 197
Re: Run multiple program instances in parallel
« Reply #5 on: February 02, 2010, 06:34:50 pm »
Thanks for posting your exact solution.  It makes forum searches more useful for the few people who use them =-)

We have a very nice documentation that explains all that in detail. Hence nobody is reading. :-( So I'd say the tooltips will nobody read, too (in fact it's the first thing I disable when running a new software).
You can't defeat laziness, can you?!
I dont read thru -all- Tip of the Day tips on new software immediately but I do try to avoid disabling them and read at least 2 or 3 each time I open the program as long as the 'tips' can fit in a paragraph or less.  Just figure that if we put the most common 'lazy questions' as the very first few tips it might reduce the forum abuse.  And out of curiosity does the tip of the day window support hyperlinks?  If it does we could make sure that a couple tips that are also FAQ answers could link back to the documentation.  Preferably the first tip might just mention the documentation and do nothing BUT link to it.  That might encourage a few more users to rely on the docs too.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Run multiple program instances in parallel
« Reply #6 on: February 02, 2010, 08:06:42 pm »
That might encourage a few more users to rely on the docs too.
IIRC even 08/02 ships with an internal documentation (CHM file). Probably it's worth adding it to the nightlies, too. Hence it will eat a lot bandwidth (that was the reason we decided no to do it actually).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Run multiple program instances in parallel
« Reply #7 on: February 02, 2010, 10:01:58 pm »
Or you can add "Help -> Manual" that opens  http://www.codeblocks.org/user-manual in the user's browser
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]