replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Parallel processing
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Parallel processing
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: D�sseldorf, Germany

PostPosted: Thu Nov 06, 2008 10:57 am    Post subject: Parallel processing Reply with quote

Hi (and sorry for my question - up to now I really have no idea about it):

nowadys more and more PCs have more than one processor. What is the way to use all of them? Is it necessary to modify the code in the way that the programme subdivide the work, or does the operating system manage this? In other words: If I use my "standard" fortran code, will only one single processor run the programme?

Thanks in advance and best regards,
Wilfried
Back to top
View user's profile Send private message
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Thu Nov 06, 2008 12:28 pm    Post subject: Reply with quote

Quote:
If I use my "standard" fortran code, will only one single processor run the programme?


Yes !


However it is possible for a FTN95 written application to spawn more processes using CISSUE to issue a DOS command prompt to start another FTN95 application or alternatively START_PPROCESS@ could also be used to start another process and return immediately to the iniating application.

BUT it would take some very clever programming to split up the job so that more than one process could work on it simultaneously, then monitor all the processes and wait for them all to complete (perhaps by each process writing a log file), marshall all the results and assemble them back together.

If you intend to this, let us know how you get on and Good luck!
Back to top
View user's profile Send private message Visit poster's website
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: D�sseldorf, Germany

PostPosted: Thu Nov 06, 2008 10:57 pm    Post subject: Reply with quote

hmmm... but first thank you!

Part of my work is image processing what simply means that operations must be done on millions of pixels. For instance (to use a very simple example) imagine that for each pixel I would like to carry out the function new_value = 2*old_value. Also imagine that the image size is 10000 by 10000 pixels. If I have 4 processors I'ld like to handle the work like processor 1 = lines 1 ... 2500, processor 2 = lines 2501 ... 5000 and so on.

As far as I understood, first I must get information about the number of processors (how to do this?). After that I must split the work using (say) four times start_pprocess@, then waiting until the last processor has done the work, then matching the results together to a new image. Is that right?

Again thanks in advance...
Wilfried
Back to top
View user's profile Send private message
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Fri Nov 07, 2008 9:41 am    Post subject: Reply with quote

Wilfried,

Quote:
first I must get information about the number of processors (how to do this?).


Excuse me if I appear rude but that is simple, using environmental variables as follows:-

Code:

      CHARACTER*10 getenv@

      READ(getenv@('NUMBER_OF_PROCESSORS'),*)NPROC


Quote:

After that I must split the work using (say) four times start_pprocess@, then waiting until the last processor has done the work, then matching the results together to a new image. Is that right?


Yes, that's right! Sounds like a very interesting piece of work, I'm sure that it can be done. I've used start_pprocess@ myself to launch third party applications (FEA solvers like CalculiX), I then have a loop which checks the status of output and log files from these third party applications, when they complete my application then imports results from these other products. I have successfully done this for most of the leading FEA solvers, and it gives the impression that your own software is working seamlessly with the other packages which of course it is. Razz
Back to top
View user's profile Send private message Visit poster's website
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: D�sseldorf, Germany

PostPosted: Fri Nov 07, 2008 10:05 am    Post subject: Reply with quote

Thank you very much!

Sorry for my questions... May be I need more precise information about ftn95. I only have the manuals salfordftn95.pdf and clearwin.pdf. For instance, the fortran manual tells me about a function getenv@ but didn't show any list of possible valid parameters (like 'number_of_processors' you wrote).

Also, within these two documents no information is given about start_pprocess@. I don't what to disturb you too much - so, can you please give me an address or so to get more actual manuals? It will be the best that I first read them carefully before going on.

Best regards,
Wilfried
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Fri Nov 07, 2008 11:08 am    Post subject: Reply with quote

start_pprocess@ is described in the current ftn95.chm under start_process@.
Back to top
View user's profile Send private message AIM Address
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Fri Nov 07, 2008 11:36 am    Post subject: Reply with quote

Wilfried,

You will not find a list of arguments for getenv@ in the manuals, it is not necessary.


Instead go to:-

Start --> Settings --> Control Panel --> System Icon --> Advanced tab --> Environment variables

and you will see a list of them with their current values, gentenv@ can retrieve the value of any of them.

If that has whetted your appetite then you can get even more information about your OS and hardware using the function REGOPENKEYEX to extract stuff from the registry (but thats more involved than using getenv@ !)
Back to top
View user's profile Send private message Visit poster's website
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: D�sseldorf, Germany

PostPosted: Fri Nov 07, 2008 2:46 pm    Post subject: Reply with quote

Thanks again!

Paul: I tried to get the ftn95.chm from your website (Documentation > Silverfrost FTN95 User Guide), but in vain. I tried it in my office, I tried it at home, I tried to read and also to download, but all times an error occurs. I really have no idea what happened...

John: I found the variables and it works. Thanks!

Best regards,
Wilfried
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2402
Location: Yateley, Hants, UK

PostPosted: Sat Nov 08, 2008 2:48 pm    Post subject: Reply with quote

Not all that long ago I posted all the code necessary to get a whole bunch of processes running. You also have to make sure that they run on separate cpu cores. You can do that too. The facilities to get all the separate applications to talk to each other are standard things in Clearwin. I thought that no-one was interested!

Search for "Home made multithreading"

Eddie
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: D�sseldorf, Germany

PostPosted: Sat Nov 08, 2008 5:11 pm    Post subject: Reply with quote

Hi friend from the saxonian coast, THAT'S WHAT I NEED;-) Thanks, I'm very interested and I will report about my work - and disturb you with questions if necessary ...

Wilfried
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: D�sseldorf, Germany

PostPosted: Mon Nov 10, 2008 1:21 pm    Post subject: Reply with quote

Very interesting, indeed... I made the first tests and I hope that I begin to understand the principles.

As far as I see up to now, I must split my programme into several executables, right? Or is there any alternative to devide the work to several processors from within a single executable? What I mean is something like this:

Code:
getenv@(number_of_processors)
if (number .eq. 2) then
  switch_to_processor@(1)

  tell_him_what_to_do

  switch_to_processor@(2)

  tell_him_what_to_do
end if

...or similar, from within a single programme. But may be I have not yet understand and this is not possible.

Thanks for your patience and best regards,
Wilfried
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2402
Location: Yateley, Hants, UK

PostPosted: Mon Nov 10, 2008 1:52 pm    Post subject: Reply with quote

Hi Wilfried,

In the Dawn of Time, Salford FTN77 supported multithreading. Later, following sale of soul to devil (which happened in 2 stages, and which is what I call the move to Windows!), multithreading is not officially supported with Clearwin. Whether or not it is with .NET, I can't tell you.

The principles involved in running your Clearwin application on a multiprocessor machine is that up to a point, Windows does appear to use all the cores, but in a way that gives you no real nett benefit - although you can run multiple applications to raise the load on each cpu core.

Each window is a sort of independent application - again, up to a point. I could find no way of making particular windows attach to particular cpu cores, or even to different ones, although some sort of allocation and scheduling must be done by windows.

What I was able to do was to create separate standalone applications that could talk to each other. Then, I found that I could associate particular applications with a given cpu core (through task manager). I imagine that one could also create a flurry of mini-applications that would cause Windows to associate some with one core, and others with another core. Indeed, you can obtain (buy!) software that makes the association of a program with a particular core "persistent" (I wrote a post in reply to a "core duo" discussion thread on this).

In your example, you wouldn't get any benefit, because you wouldn't "switch_to_processor@(2)" until processor 1 had completed the tasks set in "tell_him_what_to_do@" - whereas if you start_pprocess@, you do move to the next statement (you don't with "start_process@"). In order to do what you want within a single application, there needs to be specific facilities for multi-threading, and they don't exist. However, a set of intercommunicating applications are, by definition, multithreaded, and Clearwin does have that.

In a multithreaded system, you have to be able to handle the results coming back in an order that is different from the tasks being issued. The phrase that springs to mind is "client-server computing". As that is american, the "client" is a customer in a restaurant, the "server" is a waiter. If the client has only one server, then the dishes ordered are likely to be served in the correct order. However, if there are several servers, and one is sent for starter, one for main course, and one for wine etc, then the dishes could be delivered in any sequence!

This analogy is nested, for example, the server is effectively the client for the chefs in the kitchen.

With conventional Fortran, there is only one server, and you don't ask him for the main course until after the starter has been delivered!

I think you need a different mindset to cope with multithreading, whichever way you do it.

Eddie
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: D�sseldorf, Germany

PostPosted: Mon Nov 10, 2008 2:15 pm    Post subject: Reply with quote

Thank you, Eddie.

You wrote "Later, following sale of soul to devil (... which is what I call the move to Windows!), ... ". Really nice to read that other people have the same feeling about that like me. But of course, we will not stop the time Wink

Wilfried
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2402
Location: Yateley, Hants, UK

PostPosted: Mon Nov 10, 2008 5:20 pm    Post subject: Reply with quote

Hi Wilfried,

That was just a throwaway expression. If it wasn't Windows, it would be GEM, or possibly some other Mac lookalike. FTN77 with DBOS wasn't just the fastest and "bestest" at compiling, it also had multithreading (although why, I never worked out), excellent graphics (up to VGA), loads of extra facilities like virtual memory AND some of the fastest run times for the compiled code.

I don't think that the Windows way of working is always the best. It certainly doesn't fit easily with Fortran. Quite obviously, Salford/Silverfrost did a fantastic job with Clearwin, but there are some loose ends.

The tradeoff for getting Clearwin is that you no longer have the fastest EXE. If that bothers you, write the front-end in FTN95/Clearwin and the back-end in (say) Intel Fortran. Run the back-end using start_pprocess@ ...

Regards

Eddie
Back to top
View user's profile Send private message
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Mon Nov 10, 2008 11:23 pm    Post subject: Reply with quote

Eddie,

As I recall the graphics under DOS and FTN77 was only limited by the graphics card you had installed. I recall getting SVGA and beyond with FTN77 and certainly a lot better than Win3.1 could achieve!

cheers
John
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group