C++ making algotirhm thread

Carlis

Senior member
May 19, 2006
237
0
76
Hi.
I have developed a program that minimizes the free energy in GL models. I am not going to describe my algorithm in any depth, but basically, I store values of certain functions in multi - arrays and then minimize a functional by varying function values in a single point at a time.

Right now, I am doing this on a desktop computer, but I could probably use a cluster for this purpose, and therefore I need do modify my program. I am a physics student and not a programmer and so I don't know a great deal of c++ / multi core programing.

The algorithm I use is certainly threadable. I would do something like varying the value of many points at the same time. If the points are suitably chosen (sufficiently separated), then these processes are completely independent.

Some questions come in to my mind though.

Do I have to tell the compiler in some manner that I want to thread my application?

Since we are talking about a cluster, I assume there is some latency when data travel between machines? Then I assume one has to write some sort of routine that shuffles data between the machines at certain steps during the iteration?

Finally, is this dependent on operative system? I am developing this on a mac, but will probably run it on a linux cluster...
 

Kirby

Lifer
Apr 10, 2006
12,028
2
0
I know with pthread in *nix, you have to compile with -lpthread (and naturally use the pthread library).

No clue about clustering though.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
This might be something to run on a graphics card instead, Google CUDA and OpenCL.

An nVidia GTX 260 card for under $200 has 216 "stream processors" for massively parallel data processing.

Also Google "c++ parallel programming" for information on the different libraries that are available for CPU-based programming.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,700
4,661
75
The usual system for high-performance computing is MPI. It's OS and hardware-independent, so you should have no problem there. You can download MPICH for free and see what you can do with it. Though personally I found its hardware-independence made it clunky.