ComStock 1.0.2 Stockfish with robobases

Discussion about chess-playing software (engines, hosts, opening books, platforms, etc...)
BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: ComStock 1.0.2 Stockfish with robobases

Post by BB+ » Tue Jan 25, 2011 10:57 pm

I think you do need these pthread definitions, at least if you want ComStock to run in SMP mode (at least the LOCK/UNLOCK parts are necessary I presume)--- but I would have thought it should "just work" if you have the right compiler switches to tell the compiler to use them. Trying putting "#define WINDOWS" at the top of IH-win-linux.h and see what happens.

User avatar
kingliveson
Posts: 1388
Joined: Thu Jun 10, 2010 1:22 am
Real Name: Franklin Titus
Location: 28°32'1"N 81°22'33"W

Re: ComStock 1.0.2 Stockfish with robobases

Post by kingliveson » Tue Jan 25, 2011 11:45 pm

BB+ wrote:I think you do need these pthread definitions, at least if you want ComStock to run in SMP mode (at least the LOCK/UNLOCK parts are necessary I presume)--- but I would have thought it should "just work" if you have the right compiler switches to tell the compiler to use them. Trying putting "#define WINDOWS" at the top of IH-win-linux.h and see what happens.
You are correct, this should not be a problem once he has the right #define. There are other linkage issues though...I looked at the use of extern "C" which all seemed fine. Thought I would have some time this past weekend to try to correct or find a way to build it, but there was no time.
PAWN : Knight >> Bishop >> Rook >>Queen

Prima
Posts: 328
Joined: Tue Dec 14, 2010 6:12 am

Re: ComStock 1.0.2 Stockfish with robobases

Post by Prima » Tue Jan 25, 2011 11:48 pm

BB+, I pasted the #define WINDOWS at the top of IH-win-inux (for RobboTotalCode & RobboTripleCode) so that it now looks like this:

Code: Select all

#define WINDOWS
#ifdef WINDOWS
#include <windows.h>
#define NOME_WINDOWS
/* 64 bits */
#define sint8 __int8
#define sint16 __int16
#define sint32 __int32
#define sint64 __int64
#define uint8 unsigned __int8
#define uint16 unsigned __int16
#define uint32 unsigned __int32
#define uint64 unsigned __int64
#define INLINE _inline
#define atoll _atoi64
#define TYPE_64_BIT "%I64d"
#if 1
#define MEMALIGN(a, b, c) a = _aligned_malloc (c, b)
#define ALIGNED_FREE(x) _aligned_free (x)
#else
#define MEMALIGN(a, b, c) a = malloc (c)
#define ALIGNED_FREE(x) free (x)
#endif
#define __builtin_prefetch /* 64-bits */
#ifdef WINDOWS_X64 /* 64 bits */
#include "win64bits.h"
#else
#include "win32bits.h"
#endif
but I still get these errors, from Intel the Error List:

Code: Select all

Error	1	error : a value of type "void *" cannot be assigned to an entity of type "uint64_t={unsigned __int64} *"	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleGlue.cpp	200	1	ComStockfish-1.0.2RBs-ICC-x64
Error	2	error MSB6001: Invalid command line switch for "icl.exe". Parameter "path" cannot have zero length.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\PlatformToolsets\Intel C++ Compiler XE 12.0\Microsoft.Cpp.x64.Intel C++ Compiler XE 12.0.targets	204	6	ComStockfish-1.0.2RBs-ICC-x64
and this, from the Intel Output List:

Code: Select all

1>  tt.cpp
1>  uci.cpp
1>  ucioption.cpp
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\PlatformToolsets\Intel C++ Compiler XE 12.0\Microsoft.Cpp.x64.Intel C++ Compiler XE 12.0.targets(204,5): error MSB6001: Invalid command line switch for "icl.exe". Parameter "path" cannot have zero length.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: ComStock 1.0.2 Stockfish with robobases

Post by BB+ » Wed Jan 26, 2011 12:00 am

Error 1 error : a value of type "void *" cannot be assigned to an entity of type "uint64_t={unsigned __int64} *" C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleGlue.cpp 200 1"
OK, so you need to search out this error. Most likely, there is something that is used in Windows, but not Linux. The error description is that a pointer is being used invalidly via "casting" -- this is telling the compiler something like "You have a memory location and think it points to a 64-bit element -- but now I'm telling you to interpret that data in some other way." But all this is a bit irrelevant.

More important is to actually find the error. From the above, the file is RobboTripleGlue.cpp, and I guess the line number is 200:

Code: Select all

  CREATE_MEM (TripleHash, 64, size);
So it is somewhere in the CREATE_MEM function/macro. Looking a few lines up, guess what... we find a "#ifdef WINDOWS" for this, and my guess is that it is not triggered. So a fix might be to add the line "#define WINDOWS" on line 175 of that file (right before the #ifdef) and see what happens. Again KLO might know more about how to automate the WINDOWS #define in the compilation process.

Prima
Posts: 328
Joined: Tue Dec 14, 2010 6:12 am

Re: ComStock 1.0.2 Stockfish with robobases

Post by Prima » Wed Jan 26, 2011 1:04 am

I added the #def WINDOWS (at line 175 just before the #ifdef) in the RoboTripleGlue.cpp file as you suggested but still got the this error:

Code: Select all

1>------ Build started: Project: ComStockfish-102RBs-ICC-x64, Configuration: Release x64 ------
1>  benchmark.cpp
1>  bitbase.cpp
1>  bitboard.cpp
1>  book.cpp
1>  egtb.cpp
1>  endgame.cpp
1>  evaluate.cpp
1>  history.cpp
1>  main.cpp
1>  material.cpp
1>  misc.cpp
1>  move.cpp
1>  movegen.cpp
1>  movepick.cpp
1>  pawns.cpp
1>  position.cpp
1>  RobboTotalGlue.cpp
1>  RobboTripleGlue.cpp
1>..\..\RobboTripleGlue.cpp(201): error : a value of type "void *" cannot be assigned to an entity of type "uint64_t={unsigned __int64} *"
1>      CREATE_MEM (TripleHash, 64, size);
1>      ^
1>  
1>  san.cpp
1>  search.cpp
1>  timeman.cpp
1>  tt.cpp
1>  uci.cpp
1>  ucioption.cpp
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\PlatformToolsets\Intel C++ Compiler XE 12.0\Microsoft.Cpp.x64.Intel C++ Compiler XE 12.0.targets(204,5): error MSB6001: Invalid command line switch for "icl.exe". Parameter "path" cannot have zero length.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
With slightly but same error messages:

Code: Select all

Error	1	error : a value of type "void *" cannot be assigned to an entity of type "uint64_t={unsigned __int64} *"	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleGlue.cpp	201	1	ComStockfish-102RBs-ICC-x64

Error	2	error MSB6001: Invalid command line switch for "icl.exe". Parameter "path" cannot have zero length.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\PlatformToolsets\Intel C++ Compiler XE 12.0\Microsoft.Cpp.x64.Intel C++ Compiler XE 12.0.targets	204	6	ComStockfish-102RBs-ICC-x64
BB+, I really appreciate your time/effort. Perhaps KLO would shed some light, since has a Windows OS and may pinpoint this error. Thanks again.

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: ComStock 1.0.2 Stockfish with robobases

Post by BB+ » Wed Jan 26, 2011 1:09 am

Maybe you need to put

Code: Select all

#include <windows.h>
#include <malloc.h>
right after "#define WINDOWS" in that file. My guess is that it still can't find the right function (which is _aligned_malloc it seems). If that doesn't help, I think I will let KLO try to solve it.

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: ComStock 1.0.2 Stockfish with robobases

Post by BB+ » Wed Jan 26, 2011 1:21 am

error : a value of type "void *" cannot be assigned to an entity of type "uint64_t={unsigned __int64} *"
Looking at this error again, maybe the _aligned_malloc result needs to be casted explicitly, though I would have thought the compiler would do that automatically?

So I think what it says is you need:

Code: Select all

#define MEMALIGN(a, b, c) a = (uint64_t*) _aligned_malloc (c, b)

User avatar
kingliveson
Posts: 1388
Joined: Thu Jun 10, 2010 1:22 am
Real Name: Franklin Titus
Location: 28°32'1"N 81°22'33"W

Re: ComStock 1.0.2 Stockfish with robobases

Post by kingliveson » Wed Jan 26, 2011 1:24 am

BB+ wrote:
Error 1 error : a value of type "void *" cannot be assigned to an entity of type "uint64_t={unsigned __int64} *" C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleGlue.cpp 200 1"
OK, so you need to search out this error. Most likely, there is something that is used in Windows, but not Linux. The error description is that a pointer is being used invalidly via "casting" -- this is telling the compiler something like "You have a memory location and think it points to a 64-bit element -- but now I'm telling you to interpret that data in some other way." But all this is a bit irrelevant.

More important is to actually find the error. From the above, the file is RobboTripleGlue.cpp, and I guess the line number is 200:

Code: Select all

  CREATE_MEM (TripleHash, 64, size);
So it is somewhere in the CREATE_MEM function/macro. Looking a few lines up, guess what... we find a "#ifdef WINDOWS" for this, and my guess is that it is not triggered. So a fix might be to add the line "#define WINDOWS" on line 175 of that file (right before the #ifdef) and see what happens. Again KLO might know more about how to automate the WINDOWS #define in the compilation process.

This particularly error stems from language difference between C and C++.

This line (176) works fine for C, but not C++

Code: Select all

#define MEMALIGN(a, b, c) a = _aligned_malloc (c, b)
changed to the following corrects it (I think) but there are other linkage issues that need resolving.

Code: Select all

#define MEMALIGN(a, b, c) a = (uint64_t*)_aligned_malloc (c, b)
_aligned_malloc() is of type void and can't return a value, and C++ requires explicit cast.

Edit: You beat me to it. :)
PAWN : Knight >> Bishop >> Rook >>Queen

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: ComStock 1.0.2 Stockfish with robobases

Post by BB+ » Wed Jan 26, 2011 1:29 am

Edit: You beat me to it. :)
Yes, but only now do I realise why it fails (C++ requires explicit casts, and I forgot the code was .cpp). EDIT: And now I also see that the WINDOWS stuff should already show up, as that file (line 52) has:
#include "RobboTripleCode/IH-win-linux.h" // defines

Prima
Posts: 328
Joined: Tue Dec 14, 2010 6:12 am

Re: ComStock 1.0.2 Stockfish with robobases

Post by Prima » Wed Jan 26, 2011 2:31 am

BB+, Kingliveson

Thank you both for the assistance. I applied the #define MEMALIGN(a, b, c) a = (uint64_t*)_aligned_malloc (c, b) that should be compatible with C++ but still got this error:

Code: Select all

1>------ Build started: Project: ComStockfish-102RBs-ICC-x64, Configuration: Release x64 ------
1>  benchmark.cpp
1>  bitbase.cpp
1>  bitboard.cpp
1>  book.cpp
1>  egtb.cpp
1>  endgame.cpp
1>  evaluate.cpp
1>  history.cpp
1>  main.cpp
1>  material.cpp
1>  misc.cpp
1>  move.cpp
1>  movegen.cpp
1>  movepick.cpp
1>  pawns.cpp
1>  position.cpp
1>  RobboTotalGlue.cpp
1>  RobboTripleGlue.cpp
1>..\..\RobboTripleGlue.cpp(177): warning #47: incompatible redefinition of macro "MEMALIGN" (declared at line 18 of "..\..\RobboTripleCode/IH-win-linux.h")
1>    #define MEMALIGN(a, b, c) a = (uint64_t*) _aligned_malloc (c, b)
1>            ^
1>  
1>  san.cpp
1>  search.cpp
1>  timeman.cpp
1>  tt.cpp
1>  uci.cpp
1>  ucioption.cpp
1>  RobboTotal_iniz.c
1>..\..\RobboTotalCode\RobboTotal_iniz.c(7): error : expected an identifier
1>    boolean REGISTERED = FALSE;
1>            ^
1>  
1>..\..\RobboTotalCode\RobboTotal_iniz.c(13): warning #266: function "InitTotalBaseUtility" declared implicitly
1>      InitTotalBaseUtility ();
1>      ^
1>  
1>..\..\RobboTotalCode\RobboTotal_iniz.c(34): warning #266: function "DeRegisterRobboTotalBases" declared implicitly
1>      DeRegisterRobboTotalBases ();
1>      ^
1>  
1>..\..\RobboTotalCode\RobboTotal_iniz.c(61): error : expression must be a modifiable lvalue
1>      REGISTERED = TRUE;
1>      ^
1>  
1>..\..\RobboTotalCode\RobboTotal_iniz.c(86): error : expression must be a modifiable lvalue
1>      REGISTERED = FALSE;
1>      ^
1>  
1>  Robbo_cache.c
1>..\..\RobboTotalCode\Robbo_cache.c(22): warning #2330: argument of type "volatile unsigned __int64 *" is incompatible with parameter of type "void *" (dropping qualifiers)
1>          free (CACHE_INFO[i]);
1>                ^
1>  
1>  Robbo_decomp.c
1>  Robbo_iniz.c
1>  Robbo_iniz_IO.c
1>  Robbo_usage.c
1>..\..\RobboTotalCode\Robbo_usage.c(5): warning #47: incompatible redefinition of macro "LANCpez" (declared at line 199 of "..\..\RobboTotalCode\RobboTotalBase.h")
1>    #define LANCpez(u, x) (x) = lanc_pedone[u][x]
1>            ^
1>  
1>..\..\RobboTotalCode\Robbo_usage.c(6): warning #47: incompatible redefinition of macro "LANCnor" (declared at line 200 of "..\..\RobboTotalCode\RobboTotalBase.h")
1>    #define LANCnor(u, x) (x) = lanc_norm[u][x]
1>            ^
1>  
1>  RobboTriple.c
1>..\..\RobboTripleCode\RobboTriple.c(241): warning #266: function "InitInitTripleBaseCache" declared implicitly
1>      InitInitTripleBaseCache (1);
1>      ^
1>  
1>..\..\RobboTripleCode\RobboTriple.c(242): warning #266: function "InitTripleHash" declared implicitly
1>      InitTripleHash (1);
1>      ^
1>  
1>..\..\RobboTripleCode\RobboTriple.c(295): warning #266: function "triple_statistica" declared implicitly
1>      triple_statistica ();
1>      ^
1>  
1>  RobboTripleDisk.c
1>..\..\RobboTripleCode\RobboTripleDisk.c(24): warning #2330: argument of type "volatile unsigned __int64 *" is incompatible with parameter of type "void *" (dropping qualifiers)
1>          free (TRIPLE_CACHE_NOTE[i]);
1>                ^
1>  
1>  RobboTripleValue.c
1>  RobboTriple_iniz.c
1>..\..\RobboTripleCode\RobboTriple_iniz.c(486): warning #266: function "STAT" declared implicitly
1>    	  if (STAT (NOME_FILE) == -1)
1>    	      ^
1>  
1>..\..\RobboTripleCode\RobboTriple_iniz.c(518): warning #266: function "STAT" declared implicitly
1>          if (STAT (NOME_FILE) == -1)
1>              ^
1>  
1>..\..\RobboTripleCode\RobboTriple_iniz.c(624): error : expression must have arithmetic or pointer type
1>      if (hFind == INVALID_HANDLE_VALUE || ffd == NULL)
1>                                           ^
1>  
1>  RobboWeakLoad.c
1>..\..\RobboTripleCode\RobboWeakLoad.c(41): warning #266: function "SubsumeTripleSMP" declared implicitly
1>    	  if (!SubsumeTripleSMP () || PONDERING)
1>    	       ^
1>  
1>..\..\RobboTripleCode\RobboWeakLoad.c(44): warning #266: function "OfftoneTripleSMP" declared implicitly
1>          OfftoneTripleSMP ();
1>          ^
1>  
1>..\..\RobboTripleCode\RobboWeakLoad.c(53): warning #266: function "OfftoneTripleSMP" declared implicitly
1>      OfftoneTripleSMP ();
1>      ^
1>  
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
and I got more errors messages this time:

Code: Select all

Error	2	error : expected an identifier	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTotalCode\RobboTotal_iniz.c	7	1	ComStockfish-102RBs-ICC-x64

Error	5	error : expression must be a modifiable lvalue	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTotalCode\RobboTotal_iniz.c	61	1	ComStockfish-102RBs-ICC-x64

Error	6	error : expression must be a modifiable lvalue	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTotalCode\RobboTotal_iniz.c	86	1	ComStockfish-102RBs-ICC-x64

Error	16	error : expression must have arithmetic or pointer type	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleCode\RobboTriple_iniz.c	624	1	ComStockfish-102RBs-ICC-x64

Warning	7	warning #2330: argument of type "volatile unsigned __int64 *" is incompatible with parameter of type "void *" (dropping qualifiers)	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTotalCode\Robbo_cache.c	22	1	ComStockfish-102RBs-ICC-x64

Warning	13	warning #2330: argument of type "volatile unsigned __int64 *" is incompatible with parameter of type "void *" (dropping qualifiers)	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleCode\RobboTripleDisk.c	24	1	ComStockfish-102RBs-ICC-x64

Warning	4	warning #266: function "DeRegisterRobboTotalBases" declared implicitly	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTotalCode\RobboTotal_iniz.c	34	1	ComStockfish-102RBs-ICC-x64

Warning	10	warning #266: function "InitInitTripleBaseCache" declared implicitly	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleCode\RobboTriple.c	241	1	ComStockfish-102RBs-ICC-x64

Warning	3	warning #266: function "InitTotalBaseUtility" declared implicitly	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTotalCode\RobboTotal_iniz.c	13	1	ComStockfish-102RBs-ICC-x64

Warning	11	warning #266: function "InitTripleHash" declared implicitly	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleCode\RobboTriple.c	242	1	ComStockfish-102RBs-ICC-x64

Warning	18	warning #266: function "OfftoneTripleSMP" declared implicitly	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleCode\RobboWeakLoad.c	44	1	ComStockfish-102RBs-ICC-x64

Warning	19	warning #266: function "OfftoneTripleSMP" declared implicitly	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleCode\RobboWeakLoad.c	53	1	ComStockfish-102RBs-ICC-x64

Warning	14	warning #266: function "STAT" declared implicitly	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleCode\RobboTriple_iniz.c	486	1	ComStockfish-102RBs-ICC-x64

Warning	15	warning #266: function "STAT" declared implicitly	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleCode\RobboTriple_iniz.c	518	1	ComStockfish-102RBs-ICC-x64

Warning	17	warning #266: function "SubsumeTripleSMP" declared implicitly	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleCode\RobboWeakLoad.c	41	1	ComStockfish-102RBs-ICC-x64

Warning	12	warning #266: function "triple_statistica" declared implicitly	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleCode\RobboTriple.c	295	1	ComStockfish-102RBs-ICC-x64

Warning	9	warning #47: incompatible redefinition of macro "LANCnor" (declared at line 200 of "..\..\RobboTotalCode\RobboTotalBase.h")	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTotalCode\Robbo_usage.c	6	1	ComStockfish-102RBs-ICC-x64

Warning	8	warning #47: incompatible redefinition of macro "LANCpez" (declared at line 199 of "..\..\RobboTotalCode\RobboTotalBase.h")	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTotalCode\Robbo_usage.c	5	1	ComStockfish-102RBs-ICC-x64

Warning	1	warning #47: incompatible redefinition of macro "MEMALIGN" (declared at line 18 of "..\..\RobboTripleCode/IH-win-linux.h")	C:\Users\PRIMA\Desktop\CSF-Copy\RobboTripleGlue.cpp	177	1	ComStockfish-102RBs-ICC-x64
To BB+: I should point out that I did not delete the first suggestion to add #def WINDOWS at line 175 in the RobboTripleGlue.cpp you suggested earlier. So that when I reapplied the #define MEMALIGN(a, b, c) a = (uint64_t*)_aligned_malloc (c, b) code, I still got this error.

And one more thing to add regarding compiling ComStock and/or similar engines with sources in different folders;

(1)After the initial Add/Existing items, I attempted to also add the contents of both RobboTotalCode & RobboTripleCode by repeating the process of Add/Existing items (under Solution Exploere). Is this correct?
(2)Or should I use the Add/New items instead?
(3)Or preferrably, should I copy all files from the RobboTotalCode & RobboTripleCode to the main folder with the ComStocfish source and then do the Add/Existing items all at once?

I ask these because with Tinapa1.01, all the needed source-files were located in one folder and so I didn't have this concern, as in the case of ComStock.

Thanks again for all your patience and time.

Post Reply