@@ -231,8 +231,9 @@ def github_api(repo):
231231 return repo .replace ("https://github.com" , "https://api.github.com/repos" )
232232
233233
234- def required_net (engine ):
235- net = None
234+ def required_nets (engine ):
235+ nets = {}
236+ pattern = re .compile (r"(EvalFile\w*)\s+.*\s+(nn-[a-f0-9]{12}.nnue)" )
236237 print ("Obtaining EvalFile of {} ..." .format (os .path .basename (engine )))
237238 try :
238239 with subprocess .Popen (
@@ -243,10 +244,10 @@ def required_net(engine):
243244 close_fds = not IS_WINDOWS ,
244245 ) as p :
245246 for line in iter (p .stdout .readline , "" ):
246- if "EvalFile" in line :
247- m = re . search ( "nn-[a-f0-9]{12}.nnue" , line )
248- if m :
249- net = m . group ( 0 )
247+ match = pattern . search ( line )
248+ if match :
249+ nets [ match . group ( 1 )] = match . group ( 2 )
250+
250251 except (OSError , subprocess .SubprocessError ) as e :
251252 raise WorkerException (
252253 "Unable to obtain name for required net. Error: {}" .format (str (e ))
@@ -257,7 +258,7 @@ def required_net(engine):
257258 "UCI exited with non-zero code {}" .format (format_return_code (p .returncode ))
258259 )
259260
260- return net
261+ return nets
261262
262263
263264def required_nets_from_source ():
@@ -693,7 +694,13 @@ def setup_engine(
693694 # skip temporary the profiled build for apple silicon, see
694695 # https://stackoverflow.com/questions/71580631/how-can-i-get-code-coverage-with-clang-13-0-1-on-mac
695696 make_cmd = "build" if arch == "apple-silicon" else "profile-build"
696- cmd = f"make -j { concurrency } { make_cmd } ARCH={ arch } COMP={ comp } " .split ()
697+ cmd = [
698+ "make" ,
699+ f"-j{ concurrency } " ,
700+ f"{ make_cmd } " ,
701+ f"ARCH={ arch } " ,
702+ f"COMP={ comp } " ,
703+ ]
697704
698705 # append -DNNUE_EMBEDDING_OFF to existing CXXFLAGS environment variable, if any
699706 cxx = os .environ .get ("CXXFLAGS" , "" ) + " -DNNUE_EMBEDDING_OFF"
@@ -721,16 +728,11 @@ def setup_engine(
721728 if p .returncode :
722729 raise WorkerException ("Executing {} failed. Error: {}" .format (cmd , errors ))
723730
724- # TODO: 'make strip' works fine with the new Makefile,
725- # 'try' should be safely dropped in the future
726- try :
727- subprocess .run (
728- ["make" , "strip" , f"COMP={ comp } " ],
729- stderr = subprocess .DEVNULL ,
730- check = True ,
731- )
732- except Exception as e :
733- print ("Exception stripping binary:\n " , e , sep = "" , file = sys .stderr )
731+ subprocess .run (
732+ ["make" , "strip" , f"COMP={ comp } " ],
733+ stderr = subprocess .DEVNULL ,
734+ check = True ,
735+ )
734736
735737 # We called setup_engine() because the engine was not cached.
736738 # Only another worker running in the same folder can have built the engine.
@@ -1340,17 +1342,14 @@ def parse_options(s):
13401342 file = sys .stderr ,
13411343 )
13421344
1343- # Add EvalFile with full path to cutechess options, and download the networks if missimg.
1344- net_base = required_net (base_engine )
1345- if net_base :
1346- base_options = base_options + ["option.EvalFile={}" .format (net_base )]
1347- net_new = required_net (new_engine )
1348- if net_new :
1349- new_options = new_options + ["option.EvalFile={}" .format (net_new )]
1345+ # Add EvalFile* with full path to cutechess options, and download the networks if missing.
1346+ for option , net in required_nets (base_engine ).items ():
1347+ base_options .append ("option.{}={}" .format (option , net ))
1348+ establish_validated_net (remote , testing_dir , net )
13501349
1351- for net in ( net_base , net_new ):
1352- if net :
1353- establish_validated_net (remote , testing_dir , net )
1350+ for option , net in required_nets ( new_engine ). items ( ):
1351+ new_options . append ( "option.{}={}" . format ( option , net ))
1352+ establish_validated_net (remote , testing_dir , net )
13541353
13551354 # PGN files output setup.
13561355 pgn_name = "results-" + worker_info ["unique_key" ] + ".pgn"
0 commit comments