After I used a better MinGW build, with a newer gcc (the one Ben suggested), I 
get must better results with no compiler warnings:

40.0609 kpps/GHz

Lukasz, the march options of native, i686 and core2 all worked and came out to 
similar results with i686 being slightly faster for me.


Łukasz Lew wrote:
2009/4/22 Michael Williams <michaelwilliam...@gmail.com>:
This worked for me:
C:\Libego\lukaszlew-libego-476a46885f80e1f4d83494bb632398b3974e901b>g++ -o
engine.exe ego/ego.cpp example/main.cpp -O3 -Iego -fomit-frame-pointer
-ffast-math -frename-registers

(I removed the -march switch)

22.5101 kpps/GHz

No too much :)
Can you try -march=i686 and -march=core2 (if you have core2) ?


And I was able to create a DLL like this:

C:\Libego\lukaszlew-libego-476a46885f80e1f4d83494bb632398b3974e901b>g++
-shared -o libego.dll ego/eg
o.cpp exported.cpp -O3 -Iego -fomit-frame-pointer -ffast-math
-frename-registers

46274.8727441 pps

SUCCESS!  Thanks for everyone's help.


Here are the contents of exported.cpp:

This is almost the same as Benchmark::do_playout in benchmark.cpp


#include "ego/ego.h"

__declspec(dllexport) void DoPlayouts(int playout_cnt, int * blackWins, int
* whiteWins)
{
 SimplePolicy policy;
 Board board [1];
 Board mc_board [1];
 Playout<SimplePolicy> playout(&policy, mc_board);

 for (int i = 0; i != playout_cnt; i++) {
   mc_board->load(board);
   playout_status_t status = playout.run ();
   if (status != too_long)
   {
     int score = mc_board -> score ();
     if (score > 0)
     {
       (*blackWins)++;
     }
     else
     {
       (*whiteWins)++;
     }
   }
 }
}


Łukasz Lew wrote:
Please download newest version, I made some ifdefWIN 32 ... to aid
mingw porting.
http://github.com/lukaszlew/libego/zipball/master

Under linux I can cross compile to windows binary with a following command
$ i586-mingw32msvc-g++ -o engine.exe ego/ego.cpp example/main.cpp -O3
-march=native -Iego -fomit-frame-pointer -ffast-math
-frename-registers

It might just work :)

FYI
$ i586-mingw32msvc-g++ --version
i586-mingw32msvc-g++ (GCC) 4.2.1-sjlj (mingw32-2)

And the performance I get is around 32 kpps/GHz

Lukasz

2009/4/22 Michael Williams <michaelwilliam...@gmail.com>:
Ok, I have Mingw installed now.  That sounds like the way to go.  But I
still don't know how to compile it  :/

According to the SConstruct file, I should be doing something like this
to
build, but it complains:

C:\Libego> g++ /Fobuild\ego\dbg\ego.obj /c ego\ego.cpp -DDEBUG -ggdb3
-Wall
-Wextra -Wswitch-enum -fno-inline /nologo /Iego

g++: /Fobuild\ego\dbg\ego.obj: No such file or directory
g++: /c: No such file or directory
g++: /nologo: No such file or directory
g++: /Iego: No such file or directory
In file included from ego\ego.h:27,
               from ego\ego.cpp:47:
ego\gtp.h:73: warning: `class Gtp' has virtual functions but non-virtual
destructor
In file included from ego\ego.cpp:54:
ego\player.cpp: In constructor `Player::Player()':
ego\player.cpp:27: warning: converting of negative value `-0x000000001'
to
`uint'
In file included from ego\ego.cpp:55:
ego\color.cpp: In constructor `Color::Color()':
ego\color.cpp:27: warning: converting of negative value `-0x000000001' to
`uint'


I also tried the build command for the optimized version:


C:\Libego> g++ /Fobuild\ego\opt\ego.obj /c ego\ego.cpp -DDEBUG -ggdb3
-Wall
-Wextra -Wswitch-enum -O3 -march=native -fomit-frame-pointer -ffast-math
-frename-registers /nologo /Iego

g++: /Fobuild\ego\opt\ego.obj: No such file or directory
g++: /c: No such file or directory
g++: /nologo: No such file or directory
g++: /Iego: No such file or directory
ego\ego.cpp:1: error: bad value (native) for -march= switch
ego\ego.cpp:1: error: bad value (native) for -mtune= switch


Sorry for my ignorance.



Łukasz Lew wrote:
2009/4/21 Łukasz Lew <lukasz....@gmail.com>:
mingw rules!
I compiled libego with it and got a decent 32kpps / GHz ( native g++
was 44kpps / GHz)
I used wine to run resulting exe on linux:)

Lukasz

2009/4/21 Don Dailey <dailey....@gmail.com>:
I use mingw to produce cros platform executables.   I can build
executables
for linux, win32 and win64, which for my chess program is a must since
it's
64 bit.

- Don


On Tue, Apr 21, 2009 at 5:33 AM, Łukasz Lew <lukasz....@gmail.com>
wrote:
On Tue, Apr 21, 2009 at 11:23, elife <elife2...@gmail.com> wrote:
I forgot about cygwin indeed. It is a good idea.
But can you ran the binary on a system without cygwin?
We can run the binary on a system without cygwin if we provide
cygwin1.dll.
That is great.
Another good idea is mingw.

BTW
I would like to recommend stackoverflow.com for programming
questions.
I asked this question there



http://stackoverflow.com/questions/771756/what-is-the-difference-between-cygwin-and-mingw
and got few good answers within a minute.

Lukasz

_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/


_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to