Re: EM64T compiling options?

2008-07-15 Thread E. Rens
There is an environment variable GOMP_AFFINITY in libgomp that binds
threads to single cpus. Can I use it the same way with multi-cores (i.e
GOMP_CPU_AFFINITY="0 1 2 3" in order to bind thread 1 to core 0 etc..)?
Is this a good way to take advantage of the quad architecture?

Emmanuel

On Tue, 15 Jul 2008 16:24:49 +0200, "Thomas Preud'homme"
<[EMAIL PROTECTED]> said:
> The Tuesday 15 July 2008 15:46:06 E. Rens, you wrote :
> > The loop sharing looks exciting but openmp seems difficult to use too.
> > Does openmp replace pthreads or work in combination ?
> 
> AFAIK it use pthread to work but it create all necessary pthread at
> startup to 
> avoid creating them at each loop parallelization. It should work properly 
> with pthreads, it wouldn't be packaged with gcc if it wasn't the case. 
> However I didn't test this combination.
> 
> openmp is really simple to use, easier than programming the same thing
> with 
> pthreads. You can see examples on wikipedia :
> 
> http://en.wikipedia.org/wiki/OpenMP
> 
> The purpose is to do simple parallelization. If you want to write an
> algorithm 
> which needs modification to support multi-cores, you have to do it
> yourself 
> with pthreads.
> 
> Regards
> 
> >
> > Emmanuel
> 
> 
> -- 
> Thomas Preud'homme
> 
> Why debian : http://www.debian.org/intro/why_debian
> 
> 
> --
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact
> [EMAIL PROTECTED]
> 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: EM64T compiling options?

2008-07-15 Thread Thomas Preud'homme
The Tuesday 15 July 2008 15:46:06 E. Rens, you wrote :
> The loop sharing looks exciting but openmp seems difficult to use too.
> Does openmp replace pthreads or work in combination ?

AFAIK it use pthread to work but it create all necessary pthread at startup to 
avoid creating them at each loop parallelization. It should work properly 
with pthreads, it wouldn't be packaged with gcc if it wasn't the case. 
However I didn't test this combination.

openmp is really simple to use, easier than programming the same thing with 
pthreads. You can see examples on wikipedia :

http://en.wikipedia.org/wiki/OpenMP

The purpose is to do simple parallelization. If you want to write an algorithm 
which needs modification to support multi-cores, you have to do it yourself 
with pthreads.

Regards

>
> Emmanuel


-- 
Thomas Preud'homme

Why debian : http://www.debian.org/intro/why_debian


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: EM64T compiling options?

2008-07-15 Thread E. Rens
The loop sharing looks exciting but openmp seems difficult to use too.
Does openmp replace pthreads or work in combination ? 

Emmanuel

On Tue, 15 Jul 2008 14:55:24 +0200, "Thomas Preud'homme"
<[EMAIL PROTECTED]> said:
> The Tuesday 15 July 2008 14:39:41 Lennart Sorensen, You wrote :
> > You almost certainly wouldn't.  Very few people have any reason to write
> > in assembly anymore.  You might write a critical section of code in
> > assembly, but all the glue ought to be in C, inluding anything to manage
> > pthreads to do multiple threads, which is how you take advantage of
> > multiple cores.
> 
> You also can take a look at openmp which allow you to parallelize for
> loops 
> and make easy synchronization. The support of openmp is included in
> latests 
> gcc versions.
> 
> >
> > --
> > Len Sorensen
> 
> 
> 
> -- 
> Thomas Preud'homme
> 
> Why debian : http://www.debian.org/intro/why_debian
> 
> 
> --
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact
> [EMAIL PROTECTED]
> 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: EM64T compiling options?

2008-07-15 Thread Thomas Preud'homme
The Tuesday 15 July 2008 14:39:41 Lennart Sorensen, You wrote :
> You almost certainly wouldn't.  Very few people have any reason to write
> in assembly anymore.  You might write a critical section of code in
> assembly, but all the glue ought to be in C, inluding anything to manage
> pthreads to do multiple threads, which is how you take advantage of
> multiple cores.

You also can take a look at openmp which allow you to parallelize for loops 
and make easy synchronization. The support of openmp is included in latests 
gcc versions.

>
> --
> Len Sorensen



-- 
Thomas Preud'homme

Why debian : http://www.debian.org/intro/why_debian


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: EM64T compiling options?

2008-07-15 Thread Lennart Sorensen
On Tue, Jul 15, 2008 at 11:37:52AM +0200, [EMAIL PROTECTED] wrote:
> I'm migrating from an i686 to an EM64T machine (Intel core 2 quad) and
> I'd like to know whether there are specific options that I can pass to
> gcc for an optimization of my code or if everything is blindly set up.
> How would I manage the 4 cpu cores if I was to write in assembly?

You almost certainly wouldn't.  Very few people have any reason to write
in assembly anymore.  You might write a critical section of code in
assembly, but all the glue ought to be in C, inluding anything to manage
pthreads to do multiple threads, which is how you take advantage of
multiple cores.

As for optimizing, there really aren't any options yet since there are
very few amd64 designs so far and they all have the same instruction set
and features pretty much and hence the code should be pretty much
optimal for all of them (in as much as gcc produces optimal code for
anything).

-- 
Len Sorensen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: EM64T compiling options?

2008-07-15 Thread E. Rens
Many thanks, I'll read your link with attention. Do you have further
links on threads and IPC ?
I'm thinking in rewriting an old and unfinished logical interpreter in C
that used assembly code (nasm) for truth evaluation of the smallest
elements. I'd like also to create a "small" database for prime numbers
(using John Moyer's storage code) in order to test several things on
prime numbers distribution.

A+

Emmanuel

On Tue, 15 Jul 2008 12:56:18 +0200, "Cyril Jaquier"
<[EMAIL PROTECTED]> said:
> Hi,
>
> > I'm migrating from an i686 to an EM64T machine (Intel core 2 quad) and
> > I'd like to know whether there are specific options that I can pass to
> > gcc for an optimization of my code or if everything is blindly set up.
> > How would I manage the 4 cpu cores if I was to write in assembly?
> >
>
> GCC has a lot of optimization/architecture flags. Just have a look here
> [1]. However, this won't make your software use the 4 cores.
>
> You should use threads or multiple processes with IPC. I don't know what
> you want to do but I think you should forget about writing in assembly
> and use an higher level language. You probably don't need assembly at
> all. Moreover, higher level language have sometimes concurrency and
> synchronization facilities which will help you getting the most of your
> 4 cores.
>
> Regards,
>
> Cyril Jaquier
>
> [1] http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
>


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: EM64T compiling options?

2008-07-15 Thread Cyril Jaquier

Hi,


I'm migrating from an i686 to an EM64T machine (Intel core 2 quad) and
I'd like to know whether there are specific options that I can pass to
gcc for an optimization of my code or if everything is blindly set up.
How would I manage the 4 cpu cores if I was to write in assembly?



GCC has a lot of optimization/architecture flags. Just have a look here 
[1]. However, this won't make your software use the 4 cores.


You should use threads or multiple processes with IPC. I don't know what 
you want to do but I think you should forget about writing in assembly 
and use an higher level language. You probably don't need assembly at 
all. Moreover, higher level language have sometimes concurrency and 
synchronization facilities which will help you getting the most of your 
4 cores.


Regards,

Cyril Jaquier

[1] http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



EM64T compiling options?

2008-07-15 Thread er
Hi,

I'm migrating from an i686 to an EM64T machine (Intel core 2 quad) and
I'd like to know whether there are specific options that I can pass to
gcc for an optimization of my code or if everything is blindly set up.
How would I manage the 4 cpu cores if I was to write in assembly?

Thank you in advance for any link or information on this subject.

Emmanuel


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]