1. About parallelism

Hello everybody, As many of you can see, AI subjects needs parallel processing. So the question is : how can we deal with that using Euphoria ? I saw on previous posts a wierd discussion about OpenMP. From what I have understood, OpenMP only says "split and process your loops on more avalaible hardware to improve execution speed". We all have multi core processors, without speaking about the graphic cards. I have been trough the multitasking section of the Eu manual, but it does'nt seems to use other threads&cores. Phix seems to have a set of intructions to use threads. I works since years on a nice AI software written in Eu, and I meet this problem. It is a sequential software, and only use 1 thread on 10 or more. This is a poor use of the computer for my app ! May be, some of you have opinion on this subject. Have a good time !

new topic     » topic index » view message » categorize

2. Re: About parallelism

Hi

Interesting idea, but probably the short answer is you can't, and won't be able to, as that not what Euphoria was designed to be.

What you want would proably mean a full rewrite to use multi threads and cores, and to approach the speeds that would meake it usable for AI, and there isn't the user base or developer base to do that.

There is a 'OK google' API that python uses, and this shouldn't be too hard for a dedicated individual to convert though, but otherwise you are probably out of luck.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

3. Re: About parallelism

Since you ask, my opinion is : it's time to convert your program to fortran or C++.

Using "the right tool for the job" is always a good idea, and especially true in this case.

new topic     » goto parent     » topic index » view message » categorize

4. Re: About parallelism

You don't need threads to achieve parallelism. In fact, threads are still going to limit you to a single process on a single machine, and for AI work, that may not be enough.

I'd recommend using coordinated system for passing around units of work. Either a job server like Gearman or make your own with a message queuing system like ZeroMQ.

-Greg

new topic     » goto parent     » topic index » view message » categorize

5. Re: About parallelism

clkeriolet said...

Hello everybody, As many of you can see, AI subjects needs parallel processing. So the question is : how can we deal with that using Euphoria ? I saw on previous posts a wierd discussion about OpenMP. From what I have understood, OpenMP only says "split and process your loops on more avalaible hardware to improve execution speed". We all have multi core processors, without speaking about the graphic cards. I have been trough the multitasking section of the Eu manual, but it does'nt seems to use other threads&cores. Phix seems to have a set of intructions to use threads. I works since years on a nice AI software written in Eu, and I meet this problem. It is a sequential software, and only use 1 thread on 10 or more. This is a poor use of the computer for my app ! May be, some of you have opinion on this subject. Have a good time !

A limited parallelism can be obtained in sequence operations, by feeding each element pair to separate threads

sequence A = {7, 12, 15, 19} 
sequence B = {16, 119, 121, 162} 
sequence C = A + B 
--- feed 7 + 16 to one thread, 12 + 119 to 2nd  thread, 15 + 121 to third thread and 19 + 162 to 4th thread 
new topic     » goto parent     » topic index » view message » categorize

6. Re: About parallelism

I see not just one can of worms, but many cans of worms all being opened at the same time. Multi threaded worm can opening.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

7. Re: About parallelism

Here's a question: there's a test program with EuGTK (leak.ex), designed to use 100% cpu time. You can run it and use System Monitor to see the cpu load.

My new computer has 8 cores. I can run 7 instances of leak.ex, and each goes to a separate processor, using 100% of that processors time. (The 8th I leave alone to handle the other stuff that's going on.)

If each of those instances of Eu were running a different program, and the programs had a way to talk to each other, wouldn't that accomplish the goal? *Provided, of course, you also wrote a "supervisor" program to allocate the tasks as needed*

https://sites.google.com/site/euphoriagtk/sysmon.png?attredirects=0&d=1

Edit: also, I note that when running 1 instance, the CPU used by Eu changes every few seconds (10 to 20, usually, sometimes less). Maybe this is to distribute the heat better? In the test pictured above, where all CPUs are used, there is no swapping going on.

new topic     » goto parent     » topic index » view message » categorize

8. Re: About parallelism

Hi, Thanks for the comments.

Yes when I launch 7 time my app, every instance runs nearly at the same speed as if there was only one. I shall definitely look at the leak.ex, and if every instance can talk together, then it might be a solution. As you said I need then to write a supervisor. I shall work on that.

The idea behind that is :

1- I want to continue to developp using Euphoria, and his interpreter, working in sequential mode.

2- I only need using parallelism for the compiled version.

3- Open Mp seems a good (if not perfect) solution since it is supported by GCC whitch I Use ! What I have to do is to insert in my Eucode the #openmp commands before the loops I want to be parallelized.

So I make a suggestion

1 - Could the interpreter just ignore the #openmp commands

2 - Could the Euc replicate the #openmp commands in the c code - assuming the Gcc shall compile those commands

So I can continue with a unique code to work with Eu in a sequential mode and still benefit of parallelism for the final executable Is this realistic ?

new topic     » goto parent     » topic index » view message » categorize

9. Re: About parallelism

It would be simple to write a Eu pre-processor which would comment out the # lines, for interpreted use.

It would (I think) not be simple to include the lines into the Eu-generated C before it reaches the compile stage.

I've only looked at the raw C output by Eu during the translate stage a few times, and it is not understandable at all.

It seems, however, that just calling the opemMP functions isn't going to be enough. Eu doesn't have real threads, and I'm guessing that openMP relies on that.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu