Porting GCC 4.4.0 to interix

2009-07-30 Thread Robert Oeffner

Hi,
I'm new to this mailing list and hope this is the right one I'm addressing.
Lately I have been trying to port gcc and g++ from GCC 4.4.0 to interix (the 
BSD-like unix subsystem optionally available for WinXP and Vista). The 
subsystem is shipped with gcc and g++ 3.3 and binutils 2.13 which I have 
used for the bootstrap. Based on other peoples patches I have had some 
success.


Until now there is no compiler available for interix that supports OpenMP 
and that's what I'm after. As libgomp in GCC so far isn't targeting interix 
I have made some changes to libgomp in my copy of the GCC 4.4.0 
distribution.  A new source file was created, 
gcc-4.4.0/libgomp/config/posix/interix/proc.c, which is templated on the 
existing gcc-4.4.0/libgomp/config/posix/proc.c and 
gcc-4.4.0/libgomp/config/posix/mingw32/proc.c in the distribution (see

http://www.oeffner.net/stuff/gcc-4.4.0_interix_changes.zip
or http://www.suacommunity.com/forum/tm.aspx?m=16600 ). With this file and 
modifications to GCC configuration files in the distribution I can bootstrap 
GCC 4.4.0 to build gcc and g++ compilers to support OpenMP on interix.


Although small OpenMP C++ programs builds and runs just fine I have problems 
with a large program that also uses OpenMP. The large program is unstable 
and crashes when compiled with OpenMP on interix. Compiled with g++4.4.0 
without OpenMP it runs like a charm. As we distribute this program to other 
platforms like Linux, MacOSX and Win32 where it runs fine with OpenMP I 
believe that my current implementation I have for porting libgomp to interix 
is buggy.


If anyone knows about some common or obvious pitfalls when porting libgomp 
to a new platform or if anyone has got any advice about what not to do I'd 
be very grateful.


Many thanks,

Rob





compiling libgomp separately

2009-08-01 Thread Robert Oeffner

Hi,
I'm trying to port GCC 4.4.0 to interix. I have some issues with libgomp. To 
save time rather than bootstrapping GCC each time I make a change I would 
like to compile libgomp separately to make my amendments take effect. So I 
copied gcc-4.4.0/libgomp/ to a separate folder mylibgomp/ and from there ran 
../gcc-4.4.0/libgomp/configure and gmake in that folder. libgomp does 
compile object files but no library files, libgomp.so and libgomp.a. Are 
there anyone who could point out what I'm doing wrong?


Many thanks,

Rob



--
_______
Robert Oeffner, 15 Bayford Place,  Cambridge, CB4 2UF
tel: +44(0)1223 369685,   mobile: +44(0)7712 887162






Problem with libstdc++ in GCC 4.4.0 port to interix

2009-09-22 Thread Robert Oeffner

Hi,

Probably a long shot but I wonder if anyone would have a useful tip on a 
problem porting gcc4.4.0 to interix (a BSD-like OS running on top of the 
Windows kernel).


As libgomp in GCC so far isn't targeting interix I have made some changes to 
libgomp in my copy of the GCC 4.4.0
distribution.  A new source file was created, 
gcc-4.4.0/libgomp/config/posix/interix/proc.c, which is templated on the
existing gcc-4.4.0/libgomp/config/posix/proc.c and 
gcc-4.4.0/libgomp/config/posix/mingw32/proc.c in the distribution (see 
http://www.oeffner.net/stuff/gcc-4.4.0_interix_changes.zip or 
http://www.suacommunity.com/forum/tm.aspx?m=16600 ). With this file and 
modifications to GCC configuration files in the distribution I can bootstrap 
GCC 4.4.0 to build gcc and g++ compilers on interix.


The port produces fast code for single threaded running programs. However, 
there's a major problem with OpenMP. It's something to do with libstdc++ 
that tends to go in overdrive when you request OpenMP to create more than 
one thread for the compiled program. When calling string.erase() from 
libstdc++ it somehow hogs the CPU with high kernel times and runs orders of 
magnitudes slower. The code below demonstrates the problem. It runs fast 
when using just one thread but abysmally slow when two or more threads are 
present, even though the loop doing the work is actually single threaded. 
Windows Taskmanager shows that execution times is roughly 50% kernel and 50% 
user time whenever you run more than one thread. Invoked with a single 
threaded all execution times is just spend in user mode.


If there is anyone here on this list who has a good suggestion that would be 
much appreciated.


Many thanks,

Rob


#include 
#include 

using namespace std;

const long lmax = 5;

int main()
{
   int nthreads = 1;
   cout<<"Enter number of OpenMP threads to create: ";
   cin >> nthreads;
   omp_set_num_threads(nthreads);

#pragma omp parallel
   {
#pragma omp single
   cout << "Doing string stuff with "
    
    

3 matches