Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

Compile N files at once

<< < (2/5) > >>

Very funny solution to do manual multithreading :lol:

But that solution wouldn't work if your project haves only 1 target and you have 2 or more cpu/cores.   :)

Thinking about it again, actually what I said is bull...
Dependencies are an issue with cluster compilation, but we have all files on the disk anyway. So the only thing that may have a problem is the linker which can of course only start after all jobs are finished.

Could be an interesting feature for the future. The compiler in c::b runs asynchronously anyway, and the next job is taken from the queue when the event sent by PipedProcess::OnTerminate is processed. What if there was a semaphore whose value the user could configure (1, 2, 3, whatever), and as long as there are jobs remaining and DoRunQueue() can acquire the semaphore, another compile process is started. It is only an idea, but it might just work.

Two problems only:
1. The linker has to know when to start, i.e. there must be some kind of counter for the total number of source files
2. Compiler output. How do you receive messages from 2 or 3 threads which may alternately send you stuff via stdout or sterr? One process may fail, the other may run fine. One could pass a number via wxCommandEvent::SetExtraLong, maybe. Then the complete output of one respective job could be buffered and appended to the log in one block.

The only logical solution is to make GCC multithreaded :P

So, there is no way to add -j3 (without editing the source) when using Makefiles? That would solve the problem for me but I would really like to see it implemented when calling the compiler directly.

The "-j" option is for make Parallel Execution of jobs
But for direct compilation from Code::Blocks, it (of course) doesn't make any use of make, so C::B must support multithreading when compiling directly.
Right now, it's currently multithreaded the compilation in C::B??


[0] Message Index

[#] Next page

[*] Previous page

Go to full version