Fix broken links; Verify cutechess downloads
This commit is contained in:
1 parent
027f506db9
commit
7281b2aabb
2 files changed
+82
-27
No files matched your search
+77
-22
@@ -87,25 +87,30 @@ COMPILERS = {} # Compiler for each Engine, + CPU Flags
|
||||
OSNAME = '%s %s' % (platform.system(), platform.release())
|
||||
DEBUG = True
|
||||
|
||||
def check_for_utilities():
|
||||
def locate_utility(util, force_exit=True, report_error=True):
|
||||
|
||||
def locate_utility(util):
|
||||
try:
|
||||
process = Popen([util, '--version'], stdout=PIPE)
|
||||
stdout, stderr = process.communicate()
|
||||
|
||||
try:
|
||||
process = Popen([util, '--version'], stdout=PIPE)
|
||||
stdout, stderr = process.communicate()
|
||||
ver = re.search('[0-9]+.[0-9]+.[0-9]+', str(stdout))
|
||||
print ('Located %s (%s)' % (util, ver.group()))
|
||||
return True
|
||||
|
||||
ver = re.search('[0-9]+.[0-9]+.[0-9]+', str(stdout))
|
||||
print ('Located %s (%s)' % (util.upper(), ver.group()))
|
||||
|
||||
except OSError:
|
||||
print('[Error] Unable to locate %s' % (util.upper()))
|
||||
except Exception:
|
||||
if report_error:
|
||||
print('[Error] Unable to locate %s' % (util))
|
||||
if force_exit:
|
||||
sys.exit()
|
||||
return False
|
||||
|
||||
def check_for_utilities():
|
||||
|
||||
print('\nScanning For Basic Utilities...')
|
||||
for utility in ['gcc', 'make']:
|
||||
locate_utility(utility)
|
||||
|
||||
|
||||
def init_client(arguments):
|
||||
|
||||
# Use Client.py's path as the base pathway
|
||||
@@ -157,20 +162,20 @@ def validate_syzygy_exists():
|
||||
# Reset the configuration if the file is missing
|
||||
|
||||
if SYZYGY_WDL_PATH and not os.path.isfile(wdlpath):
|
||||
print('Missing Syzygy File (%s)' % (filename + '.rtbw'))
|
||||
SYZYGY_WDL_PATH = None
|
||||
|
||||
if SYZYGY_DTZ_PATH and not os.path.isfile(dtzpath):
|
||||
print('Missing Syzygy File (%s)' % (filename + '.rtbz'))
|
||||
SYZYGY_DTZ_PATH = None
|
||||
|
||||
# Report final results, which may conflict with the original configuration
|
||||
|
||||
if SYZYGY_WDL_PATH:
|
||||
print('Verified Syzygy WDL (%s)' % (SYZYGY_WDL_PATH))
|
||||
else: print('Syzygy WDL Not Found')
|
||||
|
||||
if SYZYGY_DTZ_PATH:
|
||||
print('Verified Syzygy DTZ (%s)' % (SYZYGY_DTZ_PATH))
|
||||
else: print('Syzygy DTZ Not Found')
|
||||
|
||||
def tablebase_names(K=6):
|
||||
|
||||
@@ -314,9 +319,9 @@ def kill_cutechess(cutechess):
|
||||
@try_until_success(mesg=ERRORS['cutechess'])
|
||||
def server_download_cutechess(arguments):
|
||||
|
||||
print('\nScanning for Cutechess Binary...')
|
||||
print('\nFetching Cutechess Binary...')
|
||||
|
||||
if IS_WINDOWS and not os.path.isfile('cutechess.exe'):
|
||||
if IS_WINDOWS and not locate_utility('cutechess.exe', False, False):
|
||||
|
||||
# Fetch the source location if we are missing the binary
|
||||
source = requests.get(
|
||||
@@ -326,7 +331,11 @@ def server_download_cutechess(arguments):
|
||||
# Windows workers simply need a static compile (64-bit)
|
||||
download_file(url_join(source, 'cutechess-windows.exe'), 'cutechess.exe')
|
||||
|
||||
if IS_LINUX and not os.path.isfile('cutechess'):
|
||||
# Verify that we can execute Cutechess
|
||||
if not locate_utility('cutechess.exe', False):
|
||||
raise Exception
|
||||
|
||||
if IS_LINUX and not locate_utility('cutechess', False, False):
|
||||
|
||||
# Fetch the source location if we are missing the binary
|
||||
source = requests.get(
|
||||
@@ -337,7 +346,9 @@ def server_download_cutechess(arguments):
|
||||
download_file(url_join(source, 'cutechess-linux'), 'cutechess')
|
||||
os.system('chmod 777 cutechess')
|
||||
|
||||
print('Cutechess Binary found or obtained')
|
||||
# Verify that we can execute Cutechess
|
||||
if not locate_utility('cutechess', False):
|
||||
raise Exception
|
||||
|
||||
@try_until_success(mesg=ERRORS['configure'])
|
||||
def server_configure_worker(arguments):
|
||||
@@ -369,14 +380,14 @@ def server_configure_worker(arguments):
|
||||
|
||||
# Compiler version was sufficient
|
||||
if tuple(map(int, match.split('.'))) >= version:
|
||||
print('%10s :: %s (%s)' % (engine, compiler, match))
|
||||
print('%10s | %s (%s)' % (engine, compiler, match))
|
||||
COMPILERS[engine] = compiler
|
||||
break
|
||||
|
||||
# Report missing engines in case the User is not expecting it
|
||||
for engine in filter(lambda x: x not in COMPILERS, data):
|
||||
compiler = data[engine]['compilers']
|
||||
print('%10s :: Missing %s' % (engine, compiler))
|
||||
print('%10s | Missing %s' % (engine, compiler))
|
||||
|
||||
print ('\nScanning for CPU Flags...')
|
||||
|
||||
@@ -392,8 +403,8 @@ def server_configure_worker(arguments):
|
||||
actual = set(f for f in flags if '__%s__ 1' % (f) in str(stdout))
|
||||
|
||||
# Report and save to global configuration
|
||||
print (' Found ::', ' '.join(list(actual)))
|
||||
print (' Missing ::', ' '.join(list(flags - actual)))
|
||||
print (' Found |', ' '.join(list(actual)))
|
||||
print (' Missing |', ' '.join(list(flags - actual)))
|
||||
COMPILERS['cpuflags'] = ' '.join(list(actual))
|
||||
|
||||
@try_until_success(mesg=ERRORS['request'])
|
||||
@@ -621,7 +632,7 @@ def download_engine(arguments, workload, branch, network):
|
||||
source = workload['test'][branch]['source']
|
||||
build_path = workload['test']['build']['path']
|
||||
|
||||
pattern = '\nEngine: %s\nBranch: %s\nCommit: %s'
|
||||
pattern = '\nEngine: [%s] %s\nCommit: %s'
|
||||
print (pattern % (engine, branch_name, commit_sha.upper()))
|
||||
|
||||
# Naming as Engine-SHA256[:8]-NETSHA256[:8]
|
||||
@@ -676,7 +687,7 @@ def run_benchmarks(arguments, workload, branch, engine):
|
||||
if len(set(bench)) > 1: return (0, 0) # Flag an error
|
||||
|
||||
print ('Bench for %s is %d' % (name, bench[0]))
|
||||
print ('NPS for %s is %d' % (name, sum(nps) // cores))
|
||||
print ('Speed for %s is %d' % (name, sum(nps) // cores))
|
||||
return bench[0], sum(nps) // cores
|
||||
|
||||
def verify_benchmarks(arguments, workload, branch, bench):
|
||||
@@ -812,3 +823,47 @@ if __name__ == '__main__':
|
||||
response = server_request_workload(arguments)
|
||||
workload = check_workload_response(arguments, response)
|
||||
if workload: complete_workload(arguments, workload)
|
||||
|
||||
|
||||
# >>> x = 'cutechess-linux'
|
||||
# >>> y = 'cutechess-windows.exe'
|
||||
# >>>
|
||||
# >>>
|
||||
# >>> with open(x) as fin:
|
||||
# ...
|
||||
# ...
|
||||
# File "<stdin>", line 3
|
||||
#
|
||||
# ^
|
||||
# IndentationError: expected an indented block
|
||||
# >>>
|
||||
# >>> import hashlib
|
||||
# >>>
|
||||
# >>>
|
||||
# >>> with open(x) as fin:
|
||||
# ... content = fin.read().decode('utf-8')
|
||||
# ... print(hashlib.sha256(content).hexdigest())
|
||||
# ...
|
||||
# Traceback (most recent call last):
|
||||
# File "<stdin>", line 2, in <module>
|
||||
# File "C:\Python3\lib\encodings\cp1252.py", line 23, in decode
|
||||
# return codecs.charmap_decode(input,self.errors,decoding_table)[0]
|
||||
# UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 710: character maps to <undefined>
|
||||
# >>>
|
||||
# >>> with open(x, 'rb') as fin:
|
||||
# ... content = fin.read()
|
||||
# ... print(hashlib.sha256(content).hexdigest())
|
||||
# ...
|
||||
# 929ead50b90f5bd6a912d3cefbc0bbbe75cdc02a88b493100e2a5a5f8b47e012
|
||||
# >>>
|
||||
# >>> with
|
||||
# File "<stdin>", line 1
|
||||
# with
|
||||
# ^
|
||||
# SyntaxError: invalid syntax
|
||||
# >>>
|
||||
# >>> with open(y, 'rb') as fin:
|
||||
# ... content = fin.read()
|
||||
# ... print(hashlib.sha256(content).hexdigest())
|
||||
# ...
|
||||
# 989995590abf19cb88fc23712eef1e61caa3edf5895151f184c7e5b0ca0c97e4
|
||||
+5
-5
@@ -29,7 +29,7 @@ OPENBENCH_CONFIG = {
|
||||
|
||||
# Link to the repo on the sidebar, as well as the core files
|
||||
'framework' : 'http://github.com/AndyGrant/OpenBench/',
|
||||
'corefiles' : 'http://github.com/AndyGrant/OpenBench/raw/openV2/CoreFiles/',
|
||||
'corefiles' : 'http://github.com/AndyGrant/OpenBench/raw/master/CoreFiles/',
|
||||
|
||||
# SPRT Elo bounds and type I/II errors
|
||||
'sprt' : { 'elolower' : 0.00, 'eloupper' : 5.00, 'alpha' : 0.05, 'beta' : 0.05 },
|
||||
@@ -44,28 +44,28 @@ OPENBENCH_CONFIG = {
|
||||
'2moves_v1.epd' : {
|
||||
'name' : '2moves_v1.epd',
|
||||
'sha' : '7bec98239836f219dc41944a768c0506abed950aaec48da69a0782643e90f237',
|
||||
'source' : 'http://github.com/AndyGrant/OpenBench/raw/openV2/Books/2moves_v1.epd.zip',
|
||||
'source' : 'http://github.com/AndyGrant/OpenBench/raw/master/Books/2moves_v1.epd.zip',
|
||||
'default' : False,
|
||||
},
|
||||
|
||||
'8moves_v3.epd' : {
|
||||
'name' : '8moves_v3.epd',
|
||||
'sha' : '1f055af431656f09ee6a09d2448e0b876125f78bb7b404fca2031c403a1541e5',
|
||||
'source' : 'http://github.com/AndyGrant/OpenBench/raw/openV2/Books/8moves_v3.epd.zip',
|
||||
'source' : 'http://github.com/AndyGrant/OpenBench/raw/master/Books/8moves_v3.epd.zip',
|
||||
'default' : False,
|
||||
},
|
||||
|
||||
'3moves_FRC.epd' : {
|
||||
'name' : '3moves_FRC.epd',
|
||||
'sha' : '38d1b6c456bc3d3f69a4927e2667ef3f3fa231e253b6dc4040093f00a1c2ccb3',
|
||||
'source' : 'http://github.com/AndyGrant/OpenBench/raw/openV2/Books/3moves_FRC.epd.zip',
|
||||
'source' : 'http://github.com/AndyGrant/OpenBench/raw/master/Books/3moves_FRC.epd.zip',
|
||||
'default' : False,
|
||||
},
|
||||
|
||||
'4moves_noob.epd' : {
|
||||
'name' : '4moves_noob.epd',
|
||||
'sha' : '4be746a91e3f8af0c9344b1e72d611e9fcfe486843867a55760970a4896f284d',
|
||||
'source' : 'http://github.com/AndyGrant/OpenBench/raw/openV2/Books/4moves_noob.epd.zip',
|
||||
'source' : 'http://github.com/AndyGrant/OpenBench/raw/master/Books/4moves_noob.epd.zip',
|
||||
'default' : True,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user