├── .clang-format ├── .gitattributes ├── .gitignore ├── CONTRIBUTORS ├── Compiling.md ├── LICENSE ├── README.md ├── SelfplayTraining.md ├── TrainingHistory.md ├── cpp ├── CMakeLists.txt ├── README.md ├── book │ ├── book.cpp │ ├── book.h │ └── bookcssjs.cpp ├── command │ ├── analysis.cpp │ ├── benchmark.cpp │ ├── commandline.cpp │ ├── commandline.h │ ├── contribute.cpp │ ├── evalsgf.cpp │ ├── gatekeeper.cpp │ ├── genbook.cpp │ ├── gputest.cpp │ ├── gtp.cpp │ ├── match.cpp │ ├── misc.cpp │ ├── runtests.cpp │ ├── sandbox.cpp │ ├── selfplay.cpp │ ├── tune.cpp │ └── writetrainingdata.cpp ├── configs │ ├── analysis_example.cfg │ ├── book │ │ ├── genbook7jp.cfg │ │ └── genbook7tt.cfg │ ├── contribute_example.cfg │ ├── gtp_example.cfg │ ├── gtp_human5k_example.cfg │ ├── gtp_human9d_search_example.cfg │ ├── match_example.cfg │ ├── misc │ │ ├── datamining1.cfg │ │ └── datamining4.cfg │ ├── task_example.cfg │ └── training │ │ ├── README.md │ │ ├── gatekeeper1.cfg │ │ ├── gatekeeper1_maxsize9.cfg │ │ ├── gatekeeper2a.cfg │ │ ├── gatekeeper2b.cfg │ │ ├── gatekeeper2bfaster.cfg │ │ ├── gatekeeper2c.cfg │ │ ├── selfplay1.cfg │ │ ├── selfplay1_maxsize9.cfg │ │ ├── selfplay2.cfg │ │ ├── selfplay8a.cfg │ │ ├── selfplay8b.cfg │ │ ├── selfplay8b20.cfg │ │ ├── selfplay8mainb18.cfg │ │ └── selfplay8midrun.cfg ├── core │ ├── base64.cpp │ ├── base64.h │ ├── bsearch.cpp │ ├── bsearch.h │ ├── commandloop.cpp │ ├── commandloop.h │ ├── commontypes.h │ ├── config_parser.cpp │ ├── config_parser.h │ ├── datetime.cpp │ ├── datetime.h │ ├── elo.cpp │ ├── elo.h │ ├── fancymath.cpp │ ├── fancymath.h │ ├── fileutils.cpp │ ├── fileutils.h │ ├── global.cpp │ ├── global.h │ ├── hash.cpp │ ├── hash.h │ ├── logger.cpp │ ├── logger.h │ ├── mainargs.cpp │ ├── mainargs.h │ ├── makedir.cpp │ ├── makedir.h │ ├── md5.cpp │ ├── md5.h │ ├── multithread.cpp │ ├── multithread.h │ ├── os.h │ ├── parallel.cpp │ ├── parallel.h │ ├── prioritymutex.h │ ├── rand.cpp │ ├── rand.h │ ├── rand_helpers.cpp │ ├── rand_helpers.h │ ├── sha2.cpp │ ├── sha2.h │ ├── simpleallocator.h │ ├── test.cpp │ ├── test.h │ ├── threadsafecounter.cpp │ ├── threadsafecounter.h │ ├── threadsafequeue.cpp │ ├── threadsafequeue.h │ ├── threadtest.cpp │ ├── threadtest.h │ ├── throttle.h │ ├── timer.cpp │ ├── timer.h │ └── using.h ├── dataio │ ├── files.cpp │ ├── files.h │ ├── homedata.cpp │ ├── homedata.h │ ├── loadmodel.cpp │ ├── loadmodel.h │ ├── numpywrite.cpp │ ├── numpywrite.h │ ├── poswriter.cpp │ ├── poswriter.h │ ├── sgf.cpp │ ├── sgf.h │ ├── trainingwrite.cpp │ └── trainingwrite.h ├── distributed │ ├── client.cpp │ ├── client.h │ ├── clienttask.cpp │ └── httplib_wrapper.h ├── external │ ├── clblast │ │ ├── LICENSE │ │ ├── common.opencl │ │ ├── xgemm_batched.opencl │ │ ├── xgemm_direct_batched.opencl │ │ ├── xgemm_direct_part1.opencl │ │ ├── xgemm_direct_part2.opencl │ │ ├── xgemm_direct_part3.opencl │ │ ├── xgemm_part1a.opencl │ │ ├── xgemm_part1b.opencl │ │ ├── xgemm_part2.opencl │ │ ├── xgemm_part3.opencl │ │ └── xgemm_part4.opencl │ ├── filesystem-1.5.8 │ │ ├── LICENSE │ │ ├── README.md │ │ └── include │ │ │ └── ghc │ │ │ └── filesystem.hpp │ ├── half-2.2.0 │ │ ├── ChangeLog.txt │ │ ├── LICENSE.txt │ │ ├── README.txt │ │ └── include │ │ │ └── half.hpp │ ├── httplib │ │ ├── LICENSE │ │ └── httplib.h │ ├── macos │ │ └── cmake │ │ │ └── modules │ │ │ ├── AddSwift.cmake │ │ │ └── InitializeSwift.cmake │ ├── mozilla-cacerts │ │ ├── LICENSE │ │ └── cacert.pem │ ├── nlohmann_json │ │ └── json.hpp │ └── tclap-1.2.2 │ │ ├── COPYING │ │ ├── NEWS │ │ ├── README │ │ └── include │ │ └── tclap │ │ ├── Arg.h │ │ ├── ArgException.h │ │ ├── ArgTraits.h │ │ ├── CmdLine.h │ │ ├── CmdLineInterface.h │ │ ├── CmdLineOutput.h │ │ ├── Constraint.h │ │ ├── DocBookOutput.h │ │ ├── HelpVisitor.h │ │ ├── IgnoreRestVisitor.h │ │ ├── MultiArg.h │ │ ├── MultiSwitchArg.h │ │ ├── OptionalUnlabeledTracker.h │ │ ├── StandardTraits.h │ │ ├── StdOutput.h │ │ ├── SwitchArg.h │ │ ├── UnlabeledMultiArg.h │ │ ├── UnlabeledValueArg.h │ │ ├── ValueArg.h │ │ ├── ValuesConstraint.h │ │ ├── VersionVisitor.h │ │ ├── Visitor.h │ │ ├── XorHandler.h │ │ ├── ZshCompletionOutput.h │ │ └── sstream.h ├── game │ ├── board.cpp │ ├── board.h │ ├── boardhistory.cpp │ ├── boardhistory.h │ ├── graphhash.cpp │ ├── graphhash.h │ ├── rules.cpp │ └── rules.h ├── main.cpp ├── main.h ├── neuralnet │ ├── activations.h │ ├── cudabackend.cpp │ ├── cudaerrorcheck.h │ ├── cudahelpers.cu │ ├── cudahelpers.h │ ├── cudaincludes.h │ ├── cudautils.cpp │ ├── cudautils.h │ ├── desc.cpp │ ├── desc.h │ ├── dummybackend.cpp │ ├── eigenbackend.cpp │ ├── hgemm_wmma.opencl │ ├── hgemm_wmma_nchw.opencl │ ├── hgemm_wmma_nchw_part2.opencl │ ├── metalbackend.cpp │ ├── metalbackend.h │ ├── metalbackend.swift │ ├── modelversion.cpp │ ├── modelversion.h │ ├── nneval.cpp │ ├── nneval.h │ ├── nninputs.cpp │ ├── nninputs.h │ ├── nninterface.h │ ├── openclbackend.cpp │ ├── openclhelpers.cpp │ ├── openclhelpers.h │ ├── openclincludes.h │ ├── openclkernels.cpp │ ├── openclkernels.h │ ├── opencltuner.cpp │ ├── opencltuner.h │ ├── sgfmetadata.cpp │ ├── sgfmetadata.h │ └── trtbackend.cpp ├── program │ ├── gitinfotemplate.h │ ├── gtpconfig.cpp │ ├── gtpconfig.h │ ├── play.cpp │ ├── play.h │ ├── playsettings.cpp │ ├── playsettings.h │ ├── playutils.cpp │ ├── playutils.h │ ├── selfplaymanager.cpp │ ├── selfplaymanager.h │ ├── setup.cpp │ └── setup.h ├── runcmdtests.sh ├── rungpuerrortest.sh ├── runoutputtests.sh ├── runsearchtests.sh ├── runsearchtestsfp16.sh ├── runsearchtestslimited.sh ├── search │ ├── analysisdata.cpp │ ├── analysisdata.h │ ├── asyncbot.cpp │ ├── asyncbot.h │ ├── distributiontable.cpp │ ├── distributiontable.h │ ├── localpattern.cpp │ ├── localpattern.h │ ├── mutexpool.cpp │ ├── mutexpool.h │ ├── patternbonustable.cpp │ ├── patternbonustable.h │ ├── reportedsearchvalues.cpp │ ├── reportedsearchvalues.h │ ├── search.cpp │ ├── search.h │ ├── searchexplorehelpers.cpp │ ├── searchhelpers.cpp │ ├── searchmirror.cpp │ ├── searchmultithreadhelpers.cpp │ ├── searchnnhelpers.cpp │ ├── searchnode.cpp │ ├── searchnode.h │ ├── searchnodetable.cpp │ ├── searchnodetable.h │ ├── searchparams.cpp │ ├── searchparams.h │ ├── searchprint.cpp │ ├── searchprint.h │ ├── searchpuct.cpp │ ├── searchresults.cpp │ ├── searchtimehelpers.cpp │ ├── searchupdatehelpers.cpp │ ├── subtreevaluebiastable.cpp │ ├── subtreevaluebiastable.h │ ├── timecontrols.cpp │ └── timecontrols.h └── tests │ ├── analysis │ ├── badoverride.txt │ ├── basic.txt │ ├── humansl.txt.noauto │ ├── pvvisits.txt │ └── symmetry.txt │ ├── data │ ├── configs │ │ ├── analysis_example.cfg │ │ ├── folded │ │ │ ├── analysis_example.cfg │ │ │ └── test-parent.cfg │ │ ├── matchtest.cfg │ │ ├── matchtest2.cfg │ │ ├── test-circular0.cfg │ │ ├── test-circular1.cfg │ │ ├── test-duplicate.cfg │ │ ├── test.cfg │ │ ├── test1.cfg │ │ └── test2.cfg │ ├── cornermoves.sgf │ ├── foxlike.sgf │ ├── humanslbigdiff.sgf │ ├── sampletest │ │ ├── sampletest7x7.sgf │ │ └── sampletest9x9.sgf │ ├── sampletest2 │ │ └── messy.sgf │ └── test.katabook │ ├── gtp │ ├── basic.txt │ ├── ending.txt │ ├── handicap.txt │ ├── misc.txt │ ├── printsgf.txt │ ├── printsgffinalscore.txt │ ├── rawnn.txt │ ├── rules.txt │ ├── set_boardsize_twice.txt │ ├── set_position.txt │ ├── setparams.txt │ └── time.txt │ ├── models │ ├── README.txt │ ├── findLatestModelTest1 │ │ └── empty.txt │ ├── findLatestModelTest2 │ │ └── abc.bin.gz │ ├── findLatestModelTest3 │ │ └── def │ │ │ └── model.bin.gz │ ├── findLatestModelTest4 │ │ ├── abc.bin.gz │ │ └── def │ │ │ ├── ghi.bin.gz │ │ │ └── model.bin.gz │ ├── g103-b6c96-s103408384-d26419149-info.txt │ ├── g103-b6c96-s103408384-d26419149.txt.gz │ ├── g170-b6c96-s175395328-d26788732-info.txt │ ├── g170-b6c96-s175395328-d26788732.bin.gz │ ├── g170-b6c96-s175395328-d26788732.txt.gz │ ├── g170e-b10c128-s1141046784-d204142634.bin.gz │ ├── grun2-b6c96-s128700160-d49811312-info.txt │ ├── grun2-b6c96-s128700160-d49811312.txt.gz │ ├── grun50-b6c96-s156348160-d118286860.txt.gz │ ├── run4-s67105280-d24430742-b6c96-info.txt │ └── run4-s67105280-d24430742-b6c96.txt.gz │ ├── results │ ├── analysis │ │ ├── badoverride.txt.log │ │ ├── badoverride.txt.stderr │ │ ├── badoverride.txt.stdout │ │ ├── basic.txt.log │ │ ├── basic.txt.stderr │ │ ├── basic.txt.stdout │ │ ├── basic_sidetomove.stderr │ │ ├── basic_sidetomove.stdout │ │ ├── basic_sidetomove.txt.log │ │ ├── humansl_sidetomove.stderr │ │ ├── humansl_sidetomove.stdout │ │ ├── pvvisits.txt.log │ │ ├── pvvisits.txt.stderr │ │ ├── pvvisits.txt.stdout │ │ ├── pvvisits_nograph.stderr │ │ ├── pvvisits_nograph.stdout │ │ ├── pvvisits_nograph.txt.log │ │ ├── symmetry.txt.log │ │ ├── symmetry.txt.stderr │ │ ├── symmetry.txt.stdout │ │ ├── symmetry_with_pruning.stderr │ │ ├── symmetry_with_pruning.stdout │ │ └── symmetry_with_pruning.txt.log │ ├── bookhtml │ │ ├── 18 │ │ │ └── 1348BE2E185C3B383D98A2EB8CA38DEDC314696B68D5E4B733AA3BDFA0D008C2.html │ │ ├── 25 │ │ │ └── 23DD4920257320C06C3528EA2AD5206F75797D69047778590406B34267CDF23B.html │ │ ├── 31 │ │ │ └── F17EA86A31F03431F3D61EC3DFDB2CEDB673834A312D577285070E44F6822F41.html │ │ ├── 48 │ │ │ └── 00E5B7E44801D1632C1EE7142B798FC95FEC1A7A51D464655F956C4D42133016.html │ │ ├── 56 │ │ │ └── 417A1A4156ACBF58E79325D34F2A235DE4B1D62137F92AB42E507F3041D986CC.html │ │ ├── 59 │ │ │ └── 3F8C5EF0590F9F0DFD33BE889E8E00350B835EE9977532755C8971DE43A18056.html │ │ ├── 62 │ │ │ └── 07E60C476267477BF941FA45B5C35F893EB7E9BB8826468EC0D720BF3117AF7F.html │ │ ├── 66 │ │ │ └── 2EBF4C1766C5B26BDA7700D59457DC332C4B36A42DBC317B3DC59E08A7CFAA78.html │ │ ├── 78 │ │ │ └── 016DAE14782CB4D07B917F5138C3E225A230DD59794695B4A27F31C8EA4DE8E2.html │ │ ├── 80 │ │ │ └── 04ADF43B80AD7E5EC4395E736811747C73D8C9AD2E6C8A9264ED6682A14BB235.html │ │ ├── 84 │ │ │ └── 0CE5340384809D7F51CCF807E4D31450A6A5F134456A479F60F39D8787659861.html │ │ ├── 87 │ │ │ └── 115D5BAD87D16F6FC11E5253300E850840FD2E71C1081F012C2A919E4866F25E.html │ │ ├── 96 │ │ │ └── 0971EF5E9671A796679C44F5D33A7F2091A1B80BE1AC64D34EDF70D6F57F797E.html │ │ ├── 00 │ │ │ └── 1914085000B63B9CDFA79D5E46E7F4F0AF083A16D86C2847A66D1D964D580B72.html │ │ ├── 01 │ │ │ ├── 04DD95D301B0A2F4703B3208D576D815A0970CF1F769483FC5B33E4892A6A2C5.html │ │ │ └── 087A91D601B7AE323571DE219ADFC452E15F44577C11C1F33DD932B7DC3CAC06.html │ │ ├── 04 │ │ │ └── 582CE3F7042C68742DB4E536AE45BCFCF181B63082EDE6F387F79462D39983EA.html │ │ ├── 0A │ │ │ └── 0ECCECCB0A81BDB622B142764A9BB9EAB5995B73517F04D18DA0EB8F444FF807.html │ │ ├── 1C │ │ │ └── 0DD58B411C0829D8036A6E048FE73BB7A9CC0CF82C071821A9F7D88E9D459E20.html │ │ ├── 1E │ │ │ └── 085669C61E2E1EAB4C5E86C130D6133C3DEFD1FBE8D842ACBC986A7AD59AD46C.html │ │ ├── 2B │ │ │ └── 135745CA2B281C44800BA382F7B53922A1C4DFD2636DB69FFF0F3CF6A3B04901.html │ │ ├── 2C │ │ │ └── 3197D4932C12245EF43A29B4C7E0CDE724F602561A91ECE3569DC2C9C049CC05.html │ │ ├── 3E │ │ │ ├── 13CAEB503EAB113D7668ED076EABD5051936FB563F5826FD1C4C0A591A6E227D.html │ │ │ └── 746A7A933E8FC1C2DF9BBA0BD5B396F186957B85744D591D11529C005401C439.html │ │ ├── 4C │ │ │ └── 0AE3074E4C25378FC03FA107094102F35E6053FC75D50829A8E20124F872D010.html │ │ ├── 5A │ │ │ └── 68967FA95AC0019E9A08FF65DEA2C09E262864AB98C28B8614E3DC6ADF8F2299.html │ │ ├── 5B │ │ │ └── 37E7FD895BD61EAECAF38886988533E6EDEAD3DB6F26475ABC3A3C50D5934001.html │ │ ├── 8A │ │ │ ├── 04AC73B38A30BAD5FB7CA1872587A382AE175AEBC48BFB772285327758EF0249.html │ │ │ ├── 0A281BE28AACCA5150D80C1D13ECAD7EEB550661BB5E623BAE9325FDC7B97ED8.html │ │ │ └── 9A39C91C8A097F7C819FEBDA12CCC51631ABE19FDAAA2F795C0C02D132B84158.html │ │ ├── 8D │ │ │ └── 12F3FFAA8D2F04F609AEB7CAFE2D416FAB96F8B8F5E86F36735B1C9120905272.html │ │ ├── 9B │ │ │ └── 53994BA69B05FE49B9D58DB51153B0407BE897F2C4131135C5BC7AAC90C2C123.html │ │ ├── A0 │ │ │ ├── 23A3B394A056CC98CAA720A4EFE26605E43170679500026C119E60ACC0A5E25D.html │ │ │ └── 4CFF8E46A0AA542F60F6E2D484F45C06C8E97D89D0D0D9DD7C0A827994DDBBA2.html │ │ ├── A2 │ │ │ └── 5C733B2FA2111CE1463CDD3DAD7A0F58F814C7E969EE75569D7A13419AD0A5CB.html │ │ ├── A6 │ │ │ └── 2D434E13A618B96B2D08480991EA65024841C03D916CD99216082331279038A1.html │ │ ├── A8 │ │ │ └── 02013E8BA826FB1EA4448D3CC0E5B3234B05DB053AD458076C62CEB810E47B40.html │ │ ├── AF │ │ │ └── 02A8F886AF9908D438B02A0E06443CBB0631DB3E8D548DEBA51B3BF5FADEB88E.html │ │ ├── B1 │ │ │ └── 03CFDD9FB14826863905C52545E787859491A423FB884925530FACC436EF4883.html │ │ ├── B6 │ │ │ └── 04BBDFC9B6B45290032FC42860DB2A04A03622A9FFC4E364BFE570886B3C26E0.html │ │ ├── B7 │ │ │ ├── 13FB135DB7FA4709C151FB1AB0738CDD39D6CB69AB9315C9C00D781843F72EEE.html │ │ │ ├── 19AF84A1B7F809E830B722E09E2D8C4FEED975C01BFB235DC77BD1B35CAEF8F8.html │ │ │ └── 3FBBD2A1B787C6748A7D26CB2C5AC8D51FD958ACA17BC5516E4101C8F6F32C59.html │ │ ├── C3 │ │ │ └── 1274A7ACC3E0122274760B9AD42F975B532B2A27B2D70E0C8656897329704B81.html │ │ ├── C4 │ │ │ ├── 09BEE6F7C4436FE4AE6EA485F27FC0A1D51762136CFABA26A28939EC9A9D82B7.html │ │ │ └── 3C66CFA1C4081459EF4C5EDBDCD6FAA44703DF4D2F0AC62BC4E69129598CB631.html │ │ ├── C5 │ │ │ └── 34C4CA6CC54FF9201DBB9B17D93689B9E1AA73E8FBC7AFA1060853AAC6D2B01A.html │ │ ├── CC │ │ │ ├── 11CAE46CCC6762E19EE8E65A4096F2649B27B6F84884673EF9013163E9157498.html │ │ │ └── 2A4B2282CC19AA3054FB86CA301A87405FD80ACF0E31F0F9989F10B18154627A.html │ │ ├── CE │ │ │ └── 014D3080CE05146F91F3CB7E24E6687BDE992E25A651B33D548054FEFAC0D595.html │ │ ├── D1 │ │ │ └── 0B160E94D1AD7717BF170224C3237824AAD5B2F70CD26316F001415A56BFE64E.html │ │ ├── D4 │ │ │ └── 08E06FB3D454DCA4A4C9295593DDA5C80C1BCE6F62A7C0515F6E018951681C8B.html │ │ ├── D5 │ │ │ └── 0EBC1635D5BBD265ABAA804F3B8355B65206EAD290AA7A4D5465D426CF538C60.html │ │ ├── D9 │ │ │ └── 06D3670CD95F1479B97C128D7E977104CB3D703623FDB0F57DD910D91FC60217.html │ │ ├── E0 │ │ │ └── 00AA5E7BE054932A4FEDC0E2A8630E43657D6E1E9F444F7774D49A6CA90EC51D.html │ │ ├── E4 │ │ │ └── 1645D124E498577A593F5E5F66225AF6C76F731B015F1128FDDD5DC92AB88F4D.html │ │ ├── E6 │ │ │ └── 5DE5DBB5E626B16C8557A629ECD96A9F20591BD96978322C79B8A3ABAE93DACD.html │ │ ├── F8 │ │ │ └── 2CBEAE01F8379B94767891CB8FAF9E4E8A83A111CB910265346815B4DFD4ECC3.html │ │ ├── F9 │ │ │ └── 1EEE9328F9E906CAB35BBB7225762B54D3BCA5E8CC173C5F1C29CA0E8F647C71.html │ │ ├── FD │ │ │ └── 215D9460FD1631208537CEF24D5BAF24EC7B8AA7FBCA734CA02F2F47C6E4D0ED.html │ │ ├── book.css │ │ ├── book.js │ │ └── root │ │ │ └── root.html │ ├── checkbook.txt │ ├── cmd │ │ ├── analysis_help.stdout │ │ ├── benchmark_help.stdout │ │ ├── contribute_help.stdout │ │ ├── gatekeeper_help.stdout │ │ ├── genconfig_help.stdout │ │ ├── gtp_help.stdout │ │ ├── match_help.stdout │ │ └── selfplay_help.stdout │ ├── gtp │ │ ├── avoidcorners.log │ │ ├── avoidcorners.stderr │ │ ├── avoidcorners.stdout │ │ ├── basic.txt.log │ │ ├── basic.txt.stderr │ │ ├── basic.txt.stdout │ │ ├── defaultkomibutton.log │ │ ├── defaultkomibutton.stderr │ │ ├── defaultkomibutton.stdout │ │ ├── defaultkomiterr.log │ │ ├── defaultkomiterr.stderr │ │ ├── defaultkomiterr.stdout │ │ ├── defaultkomitt.log │ │ ├── defaultkomitt.stderr │ │ ├── defaultkomitt.stdout │ │ ├── ending.txt.log │ │ ├── ending.txt.stderr │ │ ├── ending.txt.stdout │ │ ├── forcedkomi.log │ │ ├── forcedkomi.stderr │ │ ├── forcedkomi.stdout │ │ ├── genmoveanalyze.log │ │ ├── genmoveanalyze.stderr │ │ ├── genmoveanalyze.stdout │ │ ├── handicap.txt.log │ │ ├── handicap.txt.stderr │ │ ├── handicap.txt.stdout │ │ ├── humansl.log │ │ ├── humansl.stderr │ │ ├── humansl.stdout │ │ ├── humansl2.stderr │ │ ├── humansl2.stdout │ │ ├── misc.txt.log │ │ ├── misc.txt.stderr │ │ ├── misc.txt.stdout │ │ ├── nologconfig.log │ │ ├── nologconfig.stderr │ │ ├── nologconfig.stdout │ │ ├── printsgf.txt.log │ │ ├── printsgf.txt.stderr │ │ ├── printsgf.txt.stdout │ │ ├── printsgffinalscore.txt.log │ │ ├── printsgffinalscore.txt.stderr │ │ ├── printsgffinalscore.txt.stdout │ │ ├── rawnn.txt.log │ │ ├── rawnn.txt.stderr │ │ ├── rawnn.txt.stdout │ │ ├── rootsymprune.log │ │ ├── rootsymprune.stderr │ │ ├── rootsymprune.stdout │ │ ├── rules.txt.log │ │ ├── rules.txt.stderr │ │ ├── rules.txt.stdout │ │ ├── searchcancellable.log │ │ ├── searchcancellable.stderr │ │ ├── searchcancellable.stdout │ │ ├── set_boardsize_twice.txt.log │ │ ├── set_boardsize_twice.txt.stderr │ │ ├── set_boardsize_twice.txt.stdout │ │ ├── set_position.txt.log │ │ ├── set_position.txt.stderr │ │ ├── set_position.txt.stdout │ │ ├── setparams.txt.log │ │ ├── setparams.txt.stderr │ │ ├── setparams.txt.stdout │ │ ├── time.txt.log │ │ ├── time.txt.stderr │ │ └── time.txt.stdout │ ├── match.txt │ ├── runNNBatchingTest.txt │ ├── runNNBatchingTestFP16.txt │ ├── runNNBatchingTestNHWC.txt │ ├── runNNBatchingTestiNHWC.txt │ ├── runNNCanaryTests.txt │ ├── runNNOnTinyBoardTest.txt │ ├── runNNSymmetriesTest.txt │ ├── runNNSymmetriesTestFP16.txt │ ├── runOutputTests.txt │ ├── runSearchTests-iNCHW-cNCHW-fp16.txt │ ├── runSearchTests-iNCHW-cNCHW.txt │ ├── runSearchTests-iNHWC-cNCHW-fp16.txt │ ├── runSearchTests-iNHWC-cNCHW.txt │ ├── runSearchTests-iNHWC-cNHWC-fp16.txt │ ├── runSearchTests-iNHWC-cNHWC.txt │ ├── runSearchTests-r4-iNCHW-cNCHW.txt │ ├── runSearchTests-r4-iNHWC-cNCHW.txt │ ├── runSearchTests-r4-iNHWC-cNHWC.txt │ ├── runSearchTests-r4-s1.txt │ ├── runSearchTests-s1-fp16.txt │ ├── runSearchTests-s1.txt │ ├── runSearchTestsFP16-iNHWC-cNCHW.txt │ ├── runSearchTestsFP16-iNHWC-cNHWC.txt │ ├── runSearchTestsFP16-r4-iNHWC-cNCHW.txt │ ├── runSearchTestsFP16-r4-iNHWC-cNHWC.txt │ ├── runSearchTestsFP16-r4-s1.txt │ ├── runSearchTestsFP16-s1.txt │ ├── runSearchTestsV3-g2-iNCHW-cNCHW.txt │ ├── runSearchTestsV3-g2-iNHWC-cNCHW.txt │ ├── runSearchTestsV3-g2-iNHWC-cNHWC.txt │ ├── runSearchTestsV3-g2-s1.txt │ ├── runSearchTestsV3-g2-s5.txt │ ├── runSearchTestsV3FP16-g2-iNHWC-cNCHW.txt │ ├── runSearchTestsV3FP16-g2-iNHWC-cNHWC.txt │ ├── runSearchTestsV3FP16-g2-s1.txt │ ├── runSearchTestsV8.txt │ ├── runSearchTestsV8Bin.txt │ ├── runSearchTestsV8FP16.txt │ ├── runSearchTestsV9.txt │ ├── runSearchTestsV9B18NBT.txt │ ├── runSearchTestsV9B18NBTFP16.txt │ ├── runSearchTestsV9B40.txt │ ├── runSekiTrainWriteTests.txt │ ├── runSelfplayInitStatTests.txt │ ├── runSelfplayInitTests.txt │ ├── runTinyNNTests.txt │ ├── sampletest-basic │ │ ├── 0.startposes.txt │ │ └── log.log │ ├── sampletest-hint │ │ ├── 0.hintposes.txt │ │ └── log.log │ ├── sampletest-vf │ │ ├── 0.startposes.txt │ │ └── log.log │ ├── sampletest2-basic │ │ ├── 0.startposes.txt │ │ └── log.log │ └── sampletest2-hint │ │ ├── 0.hintposes.txt │ │ └── log.log │ ├── testboardarea.cpp │ ├── testboardbasic.cpp │ ├── testbook.cpp │ ├── testcommon.cpp │ ├── testconfig.cpp │ ├── testmisc.cpp │ ├── testnn.cpp │ ├── testnnevalcanary.cpp │ ├── testnninputs.cpp │ ├── testownership.cpp │ ├── testrules.cpp │ ├── tests.h │ ├── testscore.cpp │ ├── testsearch.cpp │ ├── testsearchcommon.cpp │ ├── testsearchcommon.h │ ├── testsearchmisc.cpp │ ├── testsearchnonn.cpp │ ├── testsearchv3.cpp │ ├── testsearchv8.cpp │ ├── testsearchv9.cpp │ ├── testsgf.cpp │ ├── testsymmetries.cpp │ ├── testtime.cpp │ ├── testtrainingwrite.cpp │ ├── tinymodel.cpp │ ├── tinymodel.h │ └── tinymodeldata.cpp ├── docs ├── Analysis_Engine.md ├── GTP_Extensions.md ├── GraphSearch.md ├── KataGoMethods.md ├── rules.html ├── rulesv0.html └── rulesv1.html ├── images ├── docs │ ├── bottlenecklonglonglongresblock.png │ ├── bottlenecklongresblock.png │ ├── bottlenecknestedresblock.png │ ├── bottleneckresblock.png │ ├── chesstransposition.png │ ├── distantprobeoldpolicy.png │ ├── doubleladderbreakoldpolicy.png │ ├── fixvariancescaleinit.png │ ├── fixvariancescaleinittrunk.png │ ├── flyingdaggerfirstlineoldpolicy.png │ ├── maskconv.png │ ├── mcgsbad1.png │ ├── mcgsbad2.png │ ├── mcgsbad3.png │ ├── mcgsbad4.png │ ├── mcgsbad5.png │ ├── mcts1.png │ ├── mcts2.png │ ├── mcts3.png │ ├── resblock.png │ └── vloss.png └── readme │ ├── jan2020vsjune2019.png │ └── katajunevslz.png ├── misc ├── badgogodgames │ ├── badgames.txt │ ├── gogodweakgames.txt │ └── surprisinggames.txt └── bots │ ├── kgs.txt │ └── ogs.txt └── python ├── README.md ├── add_kata_selfplay_meta_to_npzs.py ├── clean_checkpoint.py ├── configs └── find_poses_config.json ├── edit_checkpoint.py ├── export_model_pytorch.py ├── forward_model.py ├── genboard_common.py ├── genboard_run.py ├── genboard_train.py ├── genclumpyposes.py ├── genrandomposes.py ├── humanslnet_gui.py ├── humanslnet_server.py ├── katago ├── __init__.py ├── game │ ├── __init__.py │ ├── board.py │ ├── data.py │ ├── features.py │ ├── gamestate.py │ └── sgfmetadata.py ├── train │ ├── __init__.py │ ├── data_processing_pytorch.py │ ├── load_model.py │ ├── metrics_logging.py │ ├── metrics_pytorch.py │ ├── model_pytorch.py │ └── modelconfigs.py └── utils │ ├── elo.py │ └── push_back_generator.py ├── migrate_double_v1.py ├── migrate_optimistic_policy.py ├── migrate_qpolicy_head.py ├── migrate_softplus_fix.py ├── migrate_squared_softplus.py ├── play.py ├── query_analysis_engine_example.py ├── save_model_for_export_manual.py ├── selfplay ├── distributed │ ├── download_and_upload_and_shuffle_and_export_loop.sh │ └── upload_model_for_selfplay.sh ├── export_model_for_selfplay.sh ├── shuffle.sh ├── shuffle_and_export_loop.sh ├── shuffle_loop.sh ├── synchronous_loop.sh └── train.sh ├── shuffle.py ├── summarize_old_selfplay_files.py ├── summarize_sgfs.py ├── test.py ├── train.py ├── upload_model.py └── upload_poses.py /.gitattributes: -------------------------------------------------------------------------------- 1 | cpp/external/mozilla-cacerts/cacert.pem binary -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.[oa] 2 | *.exe 3 | *~ 4 | __pycache__ 5 | *.h5 6 | *.log 7 | *.cbp 8 | 9 | tmp*.txt 10 | 11 | cpp/write 12 | cpp/runtests 13 | cpp/example 14 | cpp/gtp 15 | cpp/gtp.log 16 | cpp/match 17 | cpp/matchcuda 18 | cpp/matchtensorflow 19 | cpp/match.log 20 | cpp/main 21 | cpp/maincuda 22 | cpp/mainopencl 23 | cpp/katago 24 | cpp/configs 25 | cpp/evalsgf 26 | cpp/run*.sh 27 | cpp/tests/scratch 28 | cpp/program/gitinfo.h 29 | 30 | cpp/tests/results/matchsgfs/games.sgfs 31 | cpp/tests/results/matchsgfs2/games.sgfs 32 | 33 | cpp/data/ 34 | versions/ 35 | cpp/build 36 | cpp/out 37 | 38 | export_model_cuda.sh 39 | mixmodels.sh 40 | runfindposes.sh 41 | runtraining.sh 42 | runlztest*.sh 43 | 44 | python/upload_all*.sh 45 | python/count_all*.sh 46 | 47 | tmp 48 | tmp.txt 49 | test.txt 50 | cpp/tmp 51 | out.txt 52 | 53 | # For clion IDE 54 | .idea 55 | 56 | # For vscode 57 | .vscode 58 | 59 | # For VS 60 | .vs 61 | cpp/CMakeSettings.json 62 | 63 | # For cmake 64 | CMakeCache.txt 65 | CMakeFiles/ 66 | Makefile 67 | cmake_install.cmake 68 | 69 | .DS_Store 70 | GPATH 71 | GRTAGS 72 | GTAGS 73 | 74 | cpp/external/httplib/cpp-httplib/ 75 | cpp/external/nlohmann_json/nlohmann_json 76 | gtp.cfg 77 | katago_contribute/ 78 | tmpsgf/ 79 | watchgame.txt 80 | models/ 81 | python/startposesupload.txt 82 | for_release/ 83 | 84 | tests/results/matchsgfs/ 85 | tests/results/matchsgfs2/ 86 | 87 | # For Metal Backend 88 | cpp/.ninja_deps 89 | cpp/.ninja_log 90 | cpp/build.ninja 91 | cpp/KataGoSwift.* 92 | cpp/include/KataGoSwift/KataGoSwift-swift.h 93 | -------------------------------------------------------------------------------- /cpp/command/commandline.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMANDLINE_H_ 2 | #define COMMANDLINE_H_ 3 | 4 | #include "../core/config_parser.h" 5 | 6 | #define TCLAP_NAMESTARTSTRING "-" //Use single dashes for all flags 7 | #include 8 | 9 | class KataHelpOutput; 10 | class Logger; 11 | 12 | class KataGoCommandLine : public TCLAP::CmdLine 13 | { 14 | TCLAP::ValueArg* modelFileArg; 15 | TCLAP::ValueArg* humanModelFileArg; 16 | TCLAP::MultiArg* configFileArg; 17 | TCLAP::MultiArg* overrideConfigArg; 18 | std::string defaultConfigFileName; 19 | int numBuiltInArgs; 20 | KataHelpOutput* helpOutput; 21 | 22 | public: 23 | KataGoCommandLine(const std::string& message); 24 | ~KataGoCommandLine(); 25 | 26 | static std::string defaultGtpConfigFileName(); 27 | 28 | void parseArgs(const std::vector& args); 29 | 30 | //Args added AFTER calling this will only show up in the long help output, and not the short usage line. 31 | void setShortUsageArgLimit(); 32 | 33 | void addModelFileArg(); 34 | void addHumanModelFileArg(); 35 | //Empty string indicates no default or no example 36 | void addConfigFileArg(const std::string& defaultConfigFileName, const std::string& exampleConfigFile); 37 | void addConfigFileArg(const std::string& defaultConfigFileName, const std::string& exampleConfigFile, bool required); 38 | void addOverrideConfigArg(); 39 | 40 | void logOverrides(Logger& logger) const; 41 | 42 | std::string getModelFile() const; 43 | bool modelFileIsDefault() const; 44 | 45 | std::string getHumanModelFile() const; 46 | 47 | //cfg must be uninitialized, this will initialize it based on user-provided arguments 48 | void getConfig(ConfigParser& cfg) const; 49 | void getConfigAllowEmpty(ConfigParser& cfg) const; 50 | 51 | private: 52 | std::vector getConfigFiles() const; 53 | void maybeApplyOverrideConfigArg(ConfigParser& cfg) const; 54 | }; 55 | 56 | #endif //COMMANDLINE_H_ 57 | -------------------------------------------------------------------------------- /cpp/core/base64.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CORE_BASE64_H_ 3 | #define CORE_BASE64_H_ 4 | 5 | #include 6 | 7 | #include "../core/global.h" 8 | 9 | namespace Base64 10 | { 11 | std::string encode(const std::string& s); 12 | std::string decode(const std::string& s); 13 | 14 | void runTests(); 15 | } 16 | 17 | #endif // CORE_BASE64_H_ 18 | -------------------------------------------------------------------------------- /cpp/core/bsearch.cpp: -------------------------------------------------------------------------------- 1 | #include "../core/bsearch.h" 2 | 3 | #include "../core/test.h" 4 | 5 | size_t BSearch::findFirstGt(const double* arr, double x, size_t low, size_t high) { 6 | if(low >= high) 7 | return high; 8 | size_t mid = (low+high)/2; 9 | if(arr[mid] > x) 10 | return findFirstGt(arr,x,low,mid); 11 | else 12 | return findFirstGt(arr,x,mid+1,high); 13 | } 14 | 15 | 16 | void BSearch::runTests() { 17 | constexpr size_t len = 13; 18 | double arr[len] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0}; 19 | for(size_t i = 0; i 5 | #include 6 | 7 | namespace BSearch { 8 | 9 | //Assumes arr is sorted. 10 | //Finds the first index i within [low,high) where arr[i] > x, or high if such an index does not exist. 11 | size_t findFirstGt(const double* arr, double x, size_t low, size_t high); 12 | 13 | //TESTING---------------------------------------------- 14 | void runTests(); 15 | } 16 | 17 | #endif //CORE_BSEARCH_H_ 18 | -------------------------------------------------------------------------------- /cpp/core/commandloop.cpp: -------------------------------------------------------------------------------- 1 | #include "../core/commandloop.h" 2 | 3 | //------------------------ 4 | #include "../core/using.h" 5 | //------------------------ 6 | 7 | string CommandLoop::processSingleCommandLine(const string& s) { 8 | string line = Global::trim(s); 9 | 10 | //Filter down to only "normal" ascii characters. Also excludes carrage returns and newlines 11 | size_t newLen = 0; 12 | for(size_t i = 0; i < line.length(); i++) 13 | if(((int)line[i] >= 32 && (int)line[i] <= 126) || line[i] == '\t') 14 | line[newLen++] = line[i]; 15 | 16 | line.erase(line.begin()+newLen, line.end()); 17 | 18 | //Remove comments 19 | size_t commentPos = line.find("#"); 20 | if(commentPos != string::npos) 21 | line = line.substr(0, commentPos); 22 | 23 | //Convert tabs to spaces 24 | for(size_t i = 0; i < line.length(); i++) 25 | if(line[i] == '\t') 26 | line[i] = ' '; 27 | 28 | line = Global::trim(line); 29 | return line; 30 | } 31 | -------------------------------------------------------------------------------- /cpp/core/commandloop.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_COMMANDLOOP_H_ 2 | #define CORE_COMMANDLOOP_H_ 3 | 4 | #include "../core/global.h" 5 | 6 | namespace CommandLoop { 7 | std::string processSingleCommandLine(const std::string& s); 8 | } 9 | 10 | #endif // CORE_COMMANDLOOP_H_ 11 | -------------------------------------------------------------------------------- /cpp/core/commontypes.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMONTYPES_H 2 | #define COMMONTYPES_H 3 | 4 | struct enabled_t { 5 | enum value { False, True, Auto }; 6 | value x; 7 | 8 | enabled_t() = default; 9 | constexpr enabled_t(value a) : x(a) { } 10 | explicit operator bool() = delete; 11 | constexpr bool operator==(enabled_t a) const { return x == a.x; } 12 | constexpr bool operator!=(enabled_t a) const { return x != a.x; } 13 | 14 | std::string toString() { 15 | return x == True ? "true" : x == False ? "false" : "auto"; 16 | } 17 | 18 | static bool tryParse(const std::string& v, enabled_t& buf) { 19 | if(v == "1" || v == "t" || v == "true" || v == "enabled" || v == "y" || v == "yes") 20 | buf = True; 21 | else if(v == "0" || v == "f" || v == "false" || v == "disabled" || v == "n" || v == "no") 22 | buf = False; 23 | else if(v == "auto") 24 | buf = Auto; 25 | else 26 | return false; 27 | return true; 28 | } 29 | 30 | }; 31 | 32 | #endif //COMMONTYPES_H 33 | -------------------------------------------------------------------------------- /cpp/core/datetime.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_DATETIME_H_ 2 | #define CORE_DATETIME_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace DateTime { 9 | //Get the current time 10 | time_t getNow(); 11 | 12 | //Return a tm struct expressing the gm time or local time 13 | std::tm gmTime(time_t time); 14 | std::tm localTime(time_t time); 15 | 16 | //Get a string representation of the date 17 | std::string getDateString(); 18 | 19 | //Get a compact string representation of the date and time usable in filenames 20 | std::string getCompactDateTimeString(); 21 | 22 | //Write the time to out as specified by fmt. See std::put_time docs for the format specifiers. 23 | void writeTimeToStream(std::ostream& out, const char* fmt, time_t time); 24 | 25 | //For debugging/testing 26 | void runTests(); 27 | } 28 | 29 | struct SimpleDate { 30 | int year; 31 | int month; 32 | int day; 33 | SimpleDate(); 34 | SimpleDate(int y, int m, int d); 35 | SimpleDate(const SimpleDate& other); 36 | SimpleDate(const std::string& s); 37 | SimpleDate& operator=(const SimpleDate& other); 38 | std::string toString() const; 39 | int numDaysAfter(const SimpleDate& other) const; 40 | int numDaysIntoYear() const; // Jan 1 is 0, Jan 2 is 1, etc. 41 | bool isDuringLeapYear() const; 42 | 43 | bool operator==(const SimpleDate& other) const; 44 | bool operator!=(const SimpleDate& other) const; 45 | bool operator<(const SimpleDate& other) const; 46 | bool operator<=(const SimpleDate& other) const; 47 | bool operator>(const SimpleDate& other) const; 48 | bool operator>=(const SimpleDate& other) const; 49 | 50 | SimpleDate& operator+=(int n); 51 | SimpleDate& operator-=(int n); 52 | friend SimpleDate operator+(SimpleDate a, int b); 53 | friend SimpleDate operator+(int a, SimpleDate b); 54 | friend SimpleDate operator-(SimpleDate a, int b); 55 | }; 56 | 57 | 58 | #endif //CORE_DATETIME_H 59 | -------------------------------------------------------------------------------- /cpp/core/elo.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_ELO_H_ 2 | #define CORE_ELO_H_ 3 | 4 | #include "../core/global.h" 5 | 6 | namespace ComputeElos { 7 | STRUCT_NAMED_PAIR(double,firstWins,double,secondWins,WLRecord); 8 | 9 | //winMatrix[a*numPlayers+b] should be a matrix of the record a has versus b when a is playing first. 10 | //priorWL is the number of wins and number of losses against a virtual 0-elo opponent 11 | std::vector computeElos( 12 | const WLRecord* winMatrix, 13 | int numPlayers, 14 | double priorWL, 15 | int maxIters, 16 | double tolerance, 17 | std::ostream* out 18 | ); 19 | 20 | //Approximately compute the standard deviation of all players' Elos, assuming each time that all other 21 | //player Elos are completely confident. 22 | //Uses a local normal approximation at the final optimal point. 23 | std::vector computeApproxEloStdevs( 24 | const std::vector& elos, 25 | const WLRecord* winMatrix, 26 | int numPlayers, 27 | double priorWL 28 | ); 29 | 30 | //What's the probability of winning correspnding to this elo difference? 31 | double probWin(double eloDiff); 32 | 33 | void runTests(); 34 | } 35 | 36 | #endif // CORE_ELO_H_ 37 | -------------------------------------------------------------------------------- /cpp/core/fancymath.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_FANCYMATH_H_ 2 | #define CORE_FANCYMATH_H_ 3 | 4 | #include "../core/global.h" 5 | 6 | namespace FancyMath { 7 | //For large or extreme values these might not be too accurate, use GSL or Boost for more accuracy 8 | double beta(double a, double b); 9 | double logbeta(double a, double b); 10 | double incompleteBeta(double x, double a, double b); 11 | double regularizedIncompleteBeta(double x, double a, double b); 12 | 13 | double evaluateContinuedFraction(const std::function& numer, const std::function& denom, double tolerance, int maxTerms); 14 | 15 | //For large or extreme values these might not be too accurate, use GSL or Boost for more accuracy 16 | double tdistpdf(double x, double degreesOfFreedom); 17 | double tdistcdf(double x, double degreesOfFreedom); 18 | double betapdf(double x, double a, double b); 19 | double betacdf(double x, double a, double b); 20 | 21 | //Given z, compute and return an approximation for the value t 22 | //such that the probability that a draw from StudentT(degreesOfFreedom) > t 23 | //is the same as a probability that a draw from StandardNormal() > z 24 | double normToTApprox(double z, double degreesOfFreedom); 25 | 26 | //predProb is scaled into the range [epsilon,1.0-epsilon]. 27 | double binaryCrossEntropy(double predProb, double targetProb, double epsilon); 28 | 29 | void runTests(); 30 | } 31 | 32 | 33 | #endif // CORE_FANCYMATH_H_ 34 | -------------------------------------------------------------------------------- /cpp/core/mainargs.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_MAINARGS_H_ 2 | #define CORE_MAINARGS_H_ 3 | 4 | #include "../core/global.h" 5 | 6 | namespace MainArgs { 7 | std::vector getCommandLineArgsUTF8(int argc, const char* const* argv); 8 | 9 | void makeCoutAndCerrAcceptUTF8(); 10 | } 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /cpp/core/makedir.cpp: -------------------------------------------------------------------------------- 1 | #include "../core/makedir.h" 2 | #include "../core/os.h" 3 | 4 | #ifdef OS_IS_WINDOWS 5 | #include 6 | #endif 7 | #ifdef OS_IS_UNIX_OR_APPLE 8 | #include 9 | #include 10 | #endif 11 | 12 | #include 13 | #include 14 | 15 | namespace gfs = ghc::filesystem; 16 | 17 | //------------------------ 18 | #include "../core/using.h" 19 | //------------------------ 20 | 21 | //WINDOWS IMPLMENTATIION------------------------------------------------------------- 22 | 23 | #ifdef OS_IS_WINDOWS 24 | 25 | void MakeDir::make(const string& path) { 26 | gfs::path gfsPath(gfs::u8path(path)); 27 | std::error_code ec; 28 | bool suc = gfs::create_directory(gfsPath, ec); 29 | if(!suc && ec) { 30 | if(ec == std::errc::file_exists) 31 | return; 32 | throw StringError("Error creating directory: " + ec.message()); 33 | } 34 | //CreateDirectory(path.c_str(),NULL); 35 | } 36 | 37 | #endif 38 | 39 | //UNIX IMPLEMENTATION------------------------------------------------------------------ 40 | 41 | #ifdef OS_IS_UNIX_OR_APPLE 42 | 43 | void MakeDir::make(const string& path) { 44 | int result = mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); 45 | if(result != 0) { 46 | if(errno == EEXIST) 47 | return; 48 | throw StringError("Error creating directory: " + path); 49 | } 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /cpp/core/makedir.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_MAKEDIR_H_ 2 | #define CORE_MAKEDIR_H_ 3 | 4 | #include "../core/global.h" 5 | 6 | namespace MakeDir { 7 | //Does nothing if already exists 8 | void make(const std::string& path); 9 | } 10 | 11 | #endif // CORE_MAKEDIR_H_ 12 | -------------------------------------------------------------------------------- /cpp/core/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * md5.h 3 | * Author: David Wu 4 | */ 5 | 6 | #ifndef CORE_MD5_H_ 7 | #define CORE_MD5_H_ 8 | 9 | #include 10 | #include 11 | 12 | namespace MD5 13 | { 14 | void get(const char* initial_msg, std::size_t initial_len, uint32_t hash[4]); 15 | void get(const uint8_t* initial_msg, std::size_t initial_len, uint32_t hash[4]); 16 | } 17 | 18 | 19 | #endif // CORE_MD5_H_ 20 | -------------------------------------------------------------------------------- /cpp/core/multithread.cpp: -------------------------------------------------------------------------------- 1 | #include "../core/multithread.h" 2 | 3 | /* This file is to ensure multithread.h compiles on its own. */ 4 | -------------------------------------------------------------------------------- /cpp/core/multithread.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_MULTITHREAD_H_ 2 | #define CORE_MULTITHREAD_H_ 3 | 4 | #include "../core/global.h" 5 | 6 | //Enable multithreading 7 | #define MULTITHREADING 8 | 9 | #ifdef MULTITHREADING 10 | #include 11 | #include 12 | #include 13 | #include 14 | #define IS_MULTITHREADING_ENABLED true 15 | #else 16 | #define IS_MULTITHREADING_ENABLED false 17 | 18 | namespace std { 19 | 20 | class mutex 21 | { public: 22 | inline void lock() {}; 23 | inline void unlock() {}; 24 | }; 25 | class thread 26 | { public: 27 | inline thread() {}; 28 | inline void join() {}; 29 | }; 30 | template 31 | class unique_lock 32 | { public: 33 | unique_lock(T t) {(void)t;}; 34 | inline void lock() {}; 35 | inline void unlock() {}; 36 | }; 37 | template 38 | class lock_guard 39 | { public: 40 | lock_guard(T t) {(void)t;}; 41 | }; 42 | class condition_variable 43 | { public: 44 | inline void notify_all() {}; 45 | template 46 | inline void wait(unique_lock lock) {(void)lock;}; 47 | }; 48 | 49 | enum memory_order 50 | { 51 | memory_order_relaxed, 52 | memory_order_acquire, 53 | memory_order_release, 54 | memory_order_acq_rel, 55 | memory_order_seq_cst, 56 | memory_order_consume, 57 | }; 58 | 59 | template 60 | class atomic 61 | { 62 | T t; 63 | public: 64 | inline atomic() : t() {} 65 | inline atomic(const atomic& other) : t(other) {} 66 | inline T& operator=(const T& other) {return (t = other);} 67 | inline T& load(memory_order m) {(void)m; return t;} 68 | inline void store(const T& other, memory_order m) {(void)m; t = other;} 69 | }; 70 | 71 | } 72 | #endif 73 | 74 | #endif // CORE_MULTITHREAD_H_ 75 | -------------------------------------------------------------------------------- /cpp/core/os.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_OS_H_ 2 | #define CORE_OS_H_ 3 | 4 | #if defined(_WIN32) || defined(_WIN64) 5 | #define OS_IS_WINDOWS 6 | #elif defined(__unix) || defined(__APPLE__) 7 | #define OS_IS_UNIX_OR_APPLE 8 | #else 9 | #error Unknown operating system! 10 | #endif 11 | 12 | #endif //CORE_OS_H_ 13 | -------------------------------------------------------------------------------- /cpp/core/parallel.cpp: -------------------------------------------------------------------------------- 1 | #include "../core/parallel.h" 2 | 3 | #include "../core/global.h" 4 | 5 | void Parallel::iterRange(int numThreads, size_t size, const std::function& f) { 6 | std::atomic counter(0); 7 | auto processLoop = [&](int threadIdx) { 8 | while(true) { 9 | size_t oldValue = counter.fetch_add(1); 10 | if(oldValue >= size) 11 | return; 12 | f(threadIdx,oldValue); 13 | } 14 | }; 15 | 16 | // Start threads 17 | std::vector threads; 18 | for(int i = 0; i& f) { 25 | std::atomic counter(0); 26 | auto processLoop = [&](int threadIdx) { 27 | while(true) { 28 | size_t oldValue = counter.fetch_add(1); 29 | if(oldValue >= size) 30 | return; 31 | f(threadIdx,oldValue); 32 | } 33 | }; 34 | auto processLoopProtected = [&logger,&processLoop](int threadIdx) { 35 | Logger::logThreadUncaught("parallel iter range loop", &logger, [&](){ processLoop(threadIdx); }); 36 | }; 37 | 38 | // Start threads 39 | std::vector threads; 40 | for(int i = 0; i& f); 12 | void iterRange(int numThreads, size_t size, Logger& logger, const std::function& f); 13 | 14 | } 15 | 16 | #endif // CORE_PARALLEL_H_ 17 | -------------------------------------------------------------------------------- /cpp/core/rand_helpers.cpp: -------------------------------------------------------------------------------- 1 | #include "../core/rand_helpers.h" 2 | 3 | /* This file is to ensure rand_helpers.h compiles on its own. */ 4 | -------------------------------------------------------------------------------- /cpp/core/rand_helpers.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_RAND_HELPERS_H_ 2 | #define CORE_RAND_HELPERS_H_ 3 | 4 | #include 5 | 6 | //------------------------------------------------------------------------------------- 7 | 8 | //xorshift1024* from http://xoroshiro.di.unimi.it/ 9 | //Not all values should be zero 10 | //Period = 2^1024 - 1 11 | //Not threadsafe 12 | class XorShift1024Mult 13 | { 14 | public: 15 | static const int XORMULT_LEN = 16; 16 | static const int XORMULT_MASK = XORMULT_LEN-1; 17 | 18 | XorShift1024Mult(const uint64_t* init_a); 19 | void init(const uint64_t* init_a); 20 | uint32_t nextUInt(); 21 | 22 | static void test(); 23 | 24 | private: 25 | uint64_t a[XORMULT_LEN]; 26 | uint64_t a_idx; 27 | }; 28 | 29 | inline uint32_t XorShift1024Mult::nextUInt() 30 | { 31 | uint64_t a0 = a[a_idx]; 32 | uint64_t a1 = a[a_idx = (a_idx + 1) & XORMULT_MASK]; 33 | a1 ^= a1 << 31; // a 34 | a1 ^= a1 >> 11; // b 35 | a0 ^= a0 >> 30; // c 36 | a[a_idx] = a0 ^ a1; 37 | uint64_t a_result = a[a_idx] * 1181783497276652981LL; 38 | 39 | return (uint32_t)(a_result >> 32); 40 | } 41 | 42 | //------------------------------------------------------------------------------------- 43 | 44 | //PCG Generator from http://www.pcg-random.org/ 45 | //Period = 2^64 46 | //Not threadsafe 47 | class PCG32 48 | { 49 | public: 50 | PCG32(uint64_t state); 51 | void init(uint64_t state); 52 | uint32_t nextUInt(); 53 | 54 | static void test(); 55 | 56 | private: 57 | uint64_t s; 58 | }; 59 | 60 | inline uint32_t PCG32::nextUInt() 61 | { 62 | s = s * 6364136223846793005ULL + 1442695040888963407ULL; 63 | uint32_t x = (uint32_t)(((s >> 18) ^ s) >> 27); 64 | int rot = (int)(s >> 59); 65 | return rot == 0 ? x : ((x >> rot) | (x << (32-rot))); 66 | } 67 | 68 | #endif // CORE_RAND_HELPERS_H_ 69 | -------------------------------------------------------------------------------- /cpp/core/simpleallocator.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_SIMPLEALLOCATOR_H 2 | #define CORE_SIMPLEALLOCATOR_H 3 | 4 | #include "../core/global.h" 5 | 6 | template 7 | struct SizedBuf; 8 | 9 | template 10 | class SimpleAllocator { 11 | std::function allocateFunc; 12 | std::function releaseFunc; 13 | 14 | std::map> buffers; 15 | 16 | public: 17 | SimpleAllocator(std::function allocateFunc_, std::function releaseFunc_) 18 | :allocateFunc(allocateFunc_),releaseFunc(releaseFunc_),buffers() 19 | { 20 | } 21 | ~SimpleAllocator() { 22 | for(auto& iter: buffers) { 23 | for(T& buf: iter.second) { 24 | releaseFunc(buf); 25 | } 26 | } 27 | } 28 | 29 | SimpleAllocator() = delete; 30 | SimpleAllocator(const SimpleAllocator&) = delete; 31 | SimpleAllocator& operator=(const SimpleAllocator&) = delete; 32 | 33 | friend struct SizedBuf; 34 | }; 35 | 36 | 37 | template 38 | struct SizedBuf { 39 | size_t size; 40 | T buf; 41 | SimpleAllocator* allocator; 42 | 43 | SizedBuf(SimpleAllocator* alloc, size_t s) 44 | : size(s),buf(),allocator(alloc) 45 | { 46 | const std::vector vec = allocator->buffers[size]; 47 | if(vec.size() <= 0) 48 | buf = allocator->allocateFunc(size); 49 | else { 50 | std::vector& buffers = allocator->buffers[size]; 51 | buf = buffers.back(); 52 | buffers.pop_back(); 53 | } 54 | } 55 | ~SizedBuf() { 56 | allocator->buffers[size].push_back(buf); 57 | } 58 | 59 | SizedBuf() = delete; 60 | SizedBuf(const SizedBuf&) = delete; 61 | SizedBuf& operator=(const SizedBuf&) = delete; 62 | 63 | friend class SimpleAllocator; 64 | }; 65 | 66 | 67 | #endif // CORE_SIMPLEALLOCATOR_H 68 | -------------------------------------------------------------------------------- /cpp/core/test.cpp: -------------------------------------------------------------------------------- 1 | #include "../core/test.h" 2 | 3 | /* This file is to ensure test.h compiles on its own. */ 4 | -------------------------------------------------------------------------------- /cpp/core/threadsafecounter.cpp: -------------------------------------------------------------------------------- 1 | #include "../core/threadsafecounter.h" 2 | 3 | /* This file is to ensure threadsafecounter.h compiles on its own. */ 4 | -------------------------------------------------------------------------------- /cpp/core/threadsafequeue.cpp: -------------------------------------------------------------------------------- 1 | #include "../core/threadsafequeue.h" 2 | 3 | /* This file is to ensure threadsafequeue.h compiles on its own. */ 4 | -------------------------------------------------------------------------------- /cpp/core/threadtest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * threadsafecounter.h 3 | * Author: davidwu 4 | */ 5 | 6 | #ifndef CORE_THREADTEST_H_ 7 | #define CORE_THREADTEST_H_ 8 | 9 | namespace ThreadTest { 10 | void runTests(); 11 | } 12 | 13 | #endif // CORE_THREADTEST_H_ 14 | -------------------------------------------------------------------------------- /cpp/core/throttle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * throttle.h 3 | * Author: lightvector 4 | */ 5 | 6 | #ifndef CORE_THROTTLE_H_ 7 | #define CORE_THROTTLE_H_ 8 | 9 | #include "../core/global.h" 10 | #include "../core/multithread.h" 11 | 12 | class Throttle { 13 | std::mutex mutex; 14 | std::condition_variable okayForMore; 15 | int numThreadsActive; 16 | const int maxThreadsActive; 17 | 18 | public: 19 | 20 | Throttle(const Throttle& other) = delete; 21 | Throttle& operator=(const Throttle& other) = delete; 22 | Throttle(Throttle&& other) = delete; 23 | Throttle& operator=(Throttle&& other) = delete; 24 | 25 | inline Throttle(int maxThreadsAtATime) 26 | :mutex(),okayForMore(),numThreadsActive(0),maxThreadsActive(maxThreadsAtATime) 27 | { 28 | assert(maxThreadsActive > 0); 29 | } 30 | inline ~Throttle() 31 | {} 32 | 33 | inline void lock() { 34 | std::unique_lock lock(mutex); 35 | assert(numThreadsActive >= 0 && numThreadsActive <= maxThreadsActive); 36 | while(numThreadsActive >= maxThreadsActive) 37 | okayForMore.wait(lock); 38 | numThreadsActive++; 39 | assert(numThreadsActive >= 0 && numThreadsActive <= maxThreadsActive); 40 | } 41 | 42 | inline void unlock() { 43 | std::lock_guard lock(mutex); 44 | assert(numThreadsActive >= 0 && numThreadsActive <= maxThreadsActive); 45 | numThreadsActive--; 46 | assert(numThreadsActive >= 0 && numThreadsActive <= maxThreadsActive); 47 | okayForMore.notify_one(); 48 | } 49 | }; 50 | 51 | class ThrottleLockGuard { 52 | Throttle* throttle; 53 | 54 | public: 55 | ThrottleLockGuard(const ThrottleLockGuard& other) = delete; 56 | ThrottleLockGuard& operator=(const ThrottleLockGuard& other) = delete; 57 | ThrottleLockGuard(ThrottleLockGuard&& other) = delete; 58 | ThrottleLockGuard& operator=(ThrottleLockGuard&& other) = delete; 59 | 60 | inline ThrottleLockGuard(Throttle& t) 61 | : throttle(&t) 62 | { 63 | throttle->lock(); 64 | } 65 | inline ~ThrottleLockGuard() { 66 | throttle->unlock(); 67 | } 68 | }; 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /cpp/core/timer.cpp: -------------------------------------------------------------------------------- 1 | #include "../core/timer.h" 2 | #include "../core/os.h" 3 | 4 | /* 5 | * timer.cpp 6 | * Author: David Wu 7 | */ 8 | 9 | //WINDOWS IMPLMENTATIION------------------------------------------------------------- 10 | 11 | #ifdef OS_IS_WINDOWS 12 | #include 13 | #include 14 | 15 | ClockTimer::ClockTimer() 16 | { 17 | reset(); 18 | } 19 | 20 | ClockTimer::~ClockTimer() 21 | { 22 | 23 | } 24 | 25 | void ClockTimer::reset() 26 | { 27 | initialTime = (int64_t)GetTickCount64(); 28 | } 29 | 30 | double ClockTimer::getSeconds() const 31 | { 32 | int64_t newTime = (int64_t)GetTickCount64(); 33 | return (double)(newTime-initialTime)/1000.0; 34 | } 35 | 36 | int64_t ClockTimer::getPrecisionSystemTime() 37 | { 38 | return (int64_t)GetTickCount64(); 39 | } 40 | 41 | #endif 42 | 43 | //UNIX IMPLEMENTATION------------------------------------------------------------------ 44 | 45 | #ifdef OS_IS_UNIX_OR_APPLE 46 | #include 47 | 48 | ClockTimer::ClockTimer() 49 | { 50 | reset(); 51 | } 52 | 53 | ClockTimer::~ClockTimer() 54 | { 55 | 56 | } 57 | 58 | void ClockTimer::reset() 59 | { 60 | auto d = std::chrono::steady_clock::now().time_since_epoch(); 61 | initialTime = std::chrono::duration(d).count(); 62 | } 63 | 64 | double ClockTimer::getSeconds() const 65 | { 66 | auto d = std::chrono::steady_clock::now().time_since_epoch(); 67 | int64_t newTime = std::chrono::duration(d).count(); 68 | return (double)(newTime-initialTime) / 1000000000.0; 69 | } 70 | 71 | int64_t ClockTimer::getPrecisionSystemTime() 72 | { 73 | auto d = std::chrono::steady_clock::now().time_since_epoch(); 74 | int64_t newTime = std::chrono::duration(d).count(); 75 | return newTime; 76 | } 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /cpp/core/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * timer.h 3 | * Author: David Wu 4 | * 5 | * A simple class for getting elapsed runtime. Should be wall time, not cpu time. 6 | * Should also be threadsafe for concurrent calls to getSeconds() 7 | * 8 | */ 9 | 10 | #ifndef CORE_TIMER_H_ 11 | #define CORE_TIMER_H_ 12 | 13 | #include 14 | 15 | class ClockTimer 16 | { 17 | int64_t initialTime; 18 | 19 | public: 20 | ClockTimer(); 21 | ~ClockTimer(); 22 | 23 | ClockTimer(const ClockTimer&) = delete; 24 | ClockTimer& operator=(const ClockTimer&) = delete; 25 | 26 | void reset(); 27 | double getSeconds() const; 28 | 29 | //Return some integer indicating the current system time (for seeds/hashes), may vary with OS. 30 | static int64_t getPrecisionSystemTime(); 31 | }; 32 | 33 | 34 | #endif // CORE_TIMER_H_ 35 | -------------------------------------------------------------------------------- /cpp/core/using.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_USING_H_ 2 | #define CORE_USING_H_ 3 | 4 | // Convenience things to just have in the namespace 5 | // Include this file last, and only ever in cpp files, not other header files. 6 | using std::vector; 7 | using std::string; 8 | using std::cout; 9 | using std::cerr; 10 | using std::cin; 11 | using std::endl; 12 | using std::istream; 13 | using std::ostream; 14 | using std::ifstream; 15 | using std::ofstream; 16 | using std::ostringstream; 17 | using std::istringstream; 18 | using std::pair; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /cpp/dataio/files.h: -------------------------------------------------------------------------------- 1 | #ifndef DATAIO_FILES_H_ 2 | #define DATAIO_FILES_H_ 3 | 4 | #include "../core/global.h" 5 | 6 | namespace FileHelpers { 7 | bool isMultiSgfs(const std::string& name); 8 | 9 | void collectSgfsFromDir(const std::string& dir, std::vector& collected); 10 | void collectSgfsFromDirOrFile(const std::string& dirOrFile, std::vector& collected); 11 | void collectSgfsFromDirs(const std::vector& dirs, std::vector& collected); 12 | void collectSgfsFromDirsOrFiles(const std::vector& dirsOrFiles, std::vector& collected); 13 | 14 | void collectMultiSgfsFromDir(const std::string& dir, std::vector& collected); 15 | void collectMultiSgfsFromDirOrFile(const std::string& dirOrFile, std::vector& collected); 16 | void collectMultiSgfsFromDirs(const std::vector& dirs, std::vector& collected); 17 | void collectMultiSgfsFromDirsOrFiles(const std::vector& dirsOrFiles, std::vector& collected); 18 | 19 | void collectPosesFromDir(const std::string& dir, std::vector& collected); 20 | void collectPosesFromDirOrFile(const std::string& dirOrFile, std::vector& collected); 21 | void collectPosesFromDirs(const std::vector& dirs, std::vector& collected); 22 | void collectPosesFromDirsOrFiles(const std::vector& dirsOrFiles, std::vector& collected); 23 | 24 | void sortNewestToOldest(std::vector& files); 25 | } 26 | 27 | 28 | #endif // DATAIO_FILES_H_ 29 | -------------------------------------------------------------------------------- /cpp/dataio/homedata.h: -------------------------------------------------------------------------------- 1 | #ifndef DATAIO_HOMEDATA_H_ 2 | #define DATAIO_HOMEDATA_H_ 3 | 4 | #include "../core/global.h" 5 | 6 | namespace HomeData { 7 | //Returns directory for reading files that may have been installed as defaults to 8 | //command line arguments, in order of preference. May throw StringError if filesystem access fails. 9 | std::vector getDefaultFilesDirs(); 10 | //A version that doesn't access the file system, intended for help messages, and should never fail. 11 | std::string getDefaultFilesDirForHelpMessage(); 12 | 13 | //Returns a directory suitable for writing data that KataGo generates automatically, such as auto-tuning data. 14 | //May throw StringError if filesystem access fails. 15 | //If makeDir is true, will attempt to create the directory if it doesn't exist. 16 | //If homeDataDirOverride is nonempty, then just uses homeDataDirOverride. 17 | std::string getHomeDataDir(bool makeDir, const std::string& homeDataDirOverride); 18 | } 19 | 20 | #endif //DATAIO_HOMEDATA_H_ 21 | -------------------------------------------------------------------------------- /cpp/dataio/loadmodel.h: -------------------------------------------------------------------------------- 1 | #ifndef DATAIO_LOADMODEL_H_ 2 | #define DATAIO_LOADMODEL_H_ 3 | 4 | #include "../core/global.h" 5 | #include "../core/logger.h" 6 | 7 | namespace LoadModel { 8 | 9 | bool findLatestModel(const std::string& modelsDir, Logger& logger, std::string& modelName, std::string& modelFile, std::string& modelDir, time_t& modelTime); 10 | 11 | void setLastModifiedTimeToNow(const std::string& filePath, Logger& logger); 12 | 13 | void deleteModelsOlderThan(const std::string& modelsDir, Logger& logger, const time_t& time); 14 | 15 | } 16 | 17 | 18 | #endif // DATAIO_LOADMODEL_H_ 19 | -------------------------------------------------------------------------------- /cpp/dataio/poswriter.h: -------------------------------------------------------------------------------- 1 | #ifndef DATAIO_POSWRITER_H_ 2 | #define DATAIO_POSWRITER_H_ 3 | 4 | #include "../core/global.h" 5 | #include "../core/threadsafequeue.h" 6 | #include "../dataio/sgf.h" 7 | #include "../dataio/trainingwrite.h" 8 | 9 | class PosWriter { 10 | public: 11 | PosWriter( 12 | const std::string& suffix, 13 | const std::string& outDir, 14 | int sgfSplitCount, 15 | int sgfSplitIdx, 16 | int maxPosesPerOutFile 17 | ); 18 | ~PosWriter(); 19 | 20 | void start(); 21 | void flushAndStop(); 22 | void writeLine(const std::string& line); 23 | void writePos(const Sgf::PositionSample& pos); 24 | 25 | private: 26 | std::string suffix; 27 | std::string outDir; 28 | int sgfSplitCount; 29 | int sgfSplitIdx; 30 | int maxPosesPerOutFile; 31 | ThreadSafeQueue toWriteQueue; 32 | std::thread* writeLoopThread; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /cpp/distributed/clienttask.cpp: -------------------------------------------------------------------------------- 1 | #include "../distributed/client.h" 2 | 3 | Client::Task::Task() 4 | :taskId(), 5 | taskGroup(), 6 | runId(), 7 | modelNameBlack(), 8 | modelNameWhite(), 9 | config() 10 | {} 11 | -------------------------------------------------------------------------------- /cpp/distributed/httplib_wrapper.h: -------------------------------------------------------------------------------- 1 | #ifdef BUILD_DISTRIBUTED 2 | 3 | #ifndef DISTRIBUTED_HTTPLIB_WRAPPER_H_ 4 | #define DISTRIBUTED_HTTPLIB_WRAPPER_H_ 5 | 6 | //The point of this wrapper is to: 7 | //1. Ensure CPPHTTPLIB_OPENSSL_SUPPORT and some other things are defined. 8 | //2. Suppress a whole ton of warnings that you get when compiling with this header, by telling GCC to treat it like a system header. 9 | 10 | #define CPPHTTPLIB_OPENSSL_SUPPORT 11 | #define CPPHTTPLIB_ZLIB_SUPPORT 12 | #pragma GCC system_header 13 | #include 14 | 15 | #endif //HTTPLIB_WRAPPER_H_ 16 | 17 | #endif //BUILD_DISTRIBUTED 18 | -------------------------------------------------------------------------------- /cpp/external/filesystem-1.5.8/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018, Steffen Schümann 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /cpp/external/half-2.2.0/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2012-2021 Christian Rau 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /cpp/external/httplib/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 yhirose 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /cpp/external/macos/cmake/modules/AddSwift.cmake: -------------------------------------------------------------------------------- 1 | # This source file is part of the Swift open source project 2 | # 3 | # Copyright (c) 2023 Apple Inc. and the Swift project authors. 4 | # Licensed under Apache License v2.0 with Runtime Library Exception 5 | # 6 | # See https://swift.org/LICENSE.txt for license information 7 | 8 | include(CheckCompilerFlag) 9 | 10 | # Generate bridging header from Swift to C++ 11 | # NOTE: This logic will eventually be upstreamed into CMake 12 | function(_swift_generate_cxx_header_target target module header) 13 | cmake_parse_arguments(ARG "" "" "SOURCES;SEARCH_PATHS;DEPENDS" ${ARGN}) 14 | if(NOT ARG_SOURCES) 15 | message(FATAL_ERROR "No sources provided to 'swift_generate_cxx_header_target'") 16 | endif() 17 | 18 | if(ARG_SEARCH_PATHS) 19 | list(TRANSFORM ARG_SEARCH_PATHS PREPEND "-I") 20 | string(REPLACE ";" " " EXPANDED_SEARCH_PATHS "${ARG_SEARCH_PATHS}") 21 | endif() 22 | 23 | if(APPLE) 24 | set(SDK_FLAGS "-sdk" "${CMAKE_OSX_SYSROOT}") 25 | elseif(WIN32) 26 | set(SDK_FLAGS "-sdk" "$ENV{SDKROOT}") 27 | endif() 28 | 29 | add_custom_command( 30 | OUTPUT 31 | "${header}" 32 | COMMAND 33 | ${CMAKE_Swift_COMPILER} -frontend -typecheck 34 | ${EXPANDED_SEARCH_PATHS} 35 | ${ARG_SOURCES} 36 | ${SDK_FLAGS} 37 | -module-name "${module}" 38 | -cxx-interoperability-mode=default 39 | -emit-clang-header-path "${header}" 40 | DEPENDS 41 | ${ARG_DEPENDS} 42 | COMMENT 43 | "Generating '${header}'" 44 | ) 45 | 46 | add_custom_target("${target}" 47 | DEPENDS 48 | "${header}" 49 | ) 50 | endfunction() 51 | -------------------------------------------------------------------------------- /cpp/external/mozilla-cacerts/LICENSE: -------------------------------------------------------------------------------- 1 | This complication of CA certificates was obtained from: 2 | https://curl.haxx.se/docs/caextract.html 3 | 4 | It derives from Mozilla Firefox source code which is covered 5 | by the Mozilla Public License 2.0: https://mozilla.org/MPL/2.0/. 6 | -------------------------------------------------------------------------------- /cpp/external/tclap-1.2.2/COPYING: -------------------------------------------------------------------------------- 1 | 2 | 3 | Copyright (c) 2003 Michael E. Smoot 4 | Copyright (c) 2004 Daniel Aarno 5 | Copyright (c) 2017 Google Inc. 6 | 7 | Permission is hereby granted, free of charge, to any person 8 | obtaining a copy of this software and associated documentation 9 | files (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 22 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 23 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | 27 | 28 | -------------------------------------------------------------------------------- /cpp/external/tclap-1.2.2/README: -------------------------------------------------------------------------------- 1 | 2 | (This version of tclap is MODIFIED slightly by David Wu ("lightvector") to 3 | make some functions virtual to allow hooking in for a bit more customization 4 | of help output.) 5 | 6 | TCLAP - Templatized Command Line Argument Parser 7 | 8 | This is a simple C++ library that facilitates parsing command line 9 | arguments in a type independent manner. It doesn't conform exactly 10 | to either the GNU or POSIX standards, although it is close. See 11 | docs/manual.html for descriptions of how things work or look at the 12 | simple examples in the examples dir. 13 | 14 | To find out what the latest changes are read the NEWS file in this directory. 15 | 16 | 17 | Any and all feedback is welcome to: Mike Smoot 18 | -------------------------------------------------------------------------------- /cpp/external/tclap-1.2.2/include/tclap/Constraint.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: Constraint.h 5 | * 6 | * Copyright (c) 2005, Michael E. Smoot 7 | * All rights reserved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | #ifndef TCLAP_CONSTRAINT_H 23 | #define TCLAP_CONSTRAINT_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace TCLAP { 33 | 34 | /** 35 | * The interface that defines the interaction between the Arg and Constraint. 36 | */ 37 | template 38 | class Constraint 39 | { 40 | 41 | public: 42 | /** 43 | * Returns a description of the Constraint. 44 | */ 45 | virtual std::string description() const =0; 46 | 47 | /** 48 | * Returns the short ID for the Constraint. 49 | */ 50 | virtual std::string shortID() const =0; 51 | 52 | /** 53 | * The method used to verify that the value parsed from the command 54 | * line meets the constraint. 55 | * \param value - The value that will be checked. 56 | */ 57 | virtual bool check(const T& value) const =0; 58 | 59 | /** 60 | * Destructor. 61 | * Silences warnings about Constraint being a base class with virtual 62 | * functions but without a virtual destructor. 63 | */ 64 | virtual ~Constraint() { ; } 65 | }; 66 | 67 | } //namespace TCLAP 68 | #endif 69 | -------------------------------------------------------------------------------- /cpp/external/tclap-1.2.2/include/tclap/IgnoreRestVisitor.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: IgnoreRestVisitor.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * All rights reserved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | 23 | #ifndef TCLAP_IGNORE_REST_VISITOR_H 24 | #define TCLAP_IGNORE_REST_VISITOR_H 25 | 26 | #include 27 | #include 28 | 29 | namespace TCLAP { 30 | 31 | /** 32 | * A Visitor that tells the CmdLine to begin ignoring arguments after 33 | * this one is parsed. 34 | */ 35 | class IgnoreRestVisitor: public Visitor 36 | { 37 | public: 38 | 39 | /** 40 | * Constructor. 41 | */ 42 | IgnoreRestVisitor() : Visitor() {} 43 | 44 | /** 45 | * Sets Arg::_ignoreRest. 46 | */ 47 | void visit() { Arg::beginIgnoring(); } 48 | }; 49 | 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /cpp/external/tclap-1.2.2/include/tclap/OptionalUnlabeledTracker.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /****************************************************************************** 4 | * 5 | * file: OptionalUnlabeledTracker.h 6 | * 7 | * Copyright (c) 2005, Michael E. Smoot . 8 | * All rights reserved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | 24 | #ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H 25 | #define TCLAP_OPTIONAL_UNLABELED_TRACKER_H 26 | 27 | #include 28 | 29 | namespace TCLAP { 30 | 31 | class OptionalUnlabeledTracker 32 | { 33 | 34 | public: 35 | 36 | static void check( bool req, const std::string& argName ); 37 | 38 | static void gotOptional() { alreadyOptionalRef() = true; } 39 | 40 | static bool& alreadyOptional() { return alreadyOptionalRef(); } 41 | 42 | private: 43 | 44 | static bool& alreadyOptionalRef() { static bool ct = false; return ct; } 45 | }; 46 | 47 | 48 | inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName ) 49 | { 50 | if ( OptionalUnlabeledTracker::alreadyOptional() ) 51 | throw( SpecificationException( 52 | "You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg", 53 | argName ) ); 54 | 55 | if ( !req ) 56 | OptionalUnlabeledTracker::gotOptional(); 57 | } 58 | 59 | 60 | } // namespace TCLAP 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /cpp/external/tclap-1.2.2/include/tclap/Visitor.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: Visitor.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * All rights reserved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | 23 | #ifndef TCLAP_VISITOR_H 24 | #define TCLAP_VISITOR_H 25 | 26 | namespace TCLAP { 27 | 28 | /** 29 | * A base class that defines the interface for visitors. 30 | */ 31 | class Visitor 32 | { 33 | public: 34 | 35 | /** 36 | * Constructor. Does nothing. 37 | */ 38 | Visitor() { } 39 | 40 | /** 41 | * Destructor. Does nothing. 42 | */ 43 | virtual ~Visitor() { } 44 | 45 | /** 46 | * Does nothing. Should be overridden by child. 47 | */ 48 | virtual void visit() { } 49 | }; 50 | 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /cpp/external/tclap-1.2.2/include/tclap/sstream.h: -------------------------------------------------------------------------------- 1 | // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- 2 | 3 | /****************************************************************************** 4 | * 5 | * file: sstream.h 6 | * 7 | * Copyright (c) 2003, Michael E. Smoot . 8 | * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno . 9 | * Copyright (c) 2017 Google Inc. 10 | * All rights reserved. 11 | * 12 | * See the file COPYING in the top directory of this distribution for 13 | * more information. 14 | * 15 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 16 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | * 23 | *****************************************************************************/ 24 | 25 | #ifndef TCLAP_SSTREAM_H 26 | #define TCLAP_SSTREAM_H 27 | 28 | #if !defined(HAVE_STRSTREAM) 29 | // Assume sstream is available if strstream is not specified 30 | // (https://sourceforge.net/p/tclap/bugs/23/) 31 | #define HAVE_SSTREAM 32 | #endif 33 | 34 | #if defined(HAVE_SSTREAM) 35 | #include 36 | namespace TCLAP { 37 | typedef std::istringstream istringstream; 38 | typedef std::ostringstream ostringstream; 39 | } 40 | #elif defined(HAVE_STRSTREAM) 41 | #include 42 | namespace TCLAP { 43 | typedef std::istrstream istringstream; 44 | typedef std::ostrstream ostringstream; 45 | } 46 | #else 47 | #error "Need a stringstream (sstream or strstream) to compile!" 48 | #endif 49 | 50 | #endif // TCLAP_SSTREAM_H 51 | -------------------------------------------------------------------------------- /cpp/game/graphhash.h: -------------------------------------------------------------------------------- 1 | #ifndef GAME_GRAPHHASH_H_ 2 | #define GAME_GRAPHHASH_H_ 3 | 4 | #include "../game/boardhistory.h" 5 | 6 | namespace GraphHash { 7 | //Hash taking into account all state relevant for move legality, the rules, and some immediate other info like effect of passing. 8 | //Does NOT take into account more complex history beyond immediate ko and superko bans. 9 | Hash128 getStateHash(const BoardHistory& hist, Player nextPlayer, double drawEquivalentWinsForWhite); 10 | 11 | //Call this AFTER making a move, to update a hash suitable for superko-safe tranpositions, given the previous graph hash. 12 | //Will guard against cycles up to repBound in size and possibly some slightly larger cycles. 13 | Hash128 getGraphHash(Hash128 prevGraphHash, const BoardHistory& hist, Player nextPlayer, int repBound, double drawEquivalentWinsForWhite); 14 | 15 | //Compute graph hash from scratch by replaying the whole history. 16 | Hash128 getGraphHashFromScratch(const BoardHistory& hist, Player nextPlayer, int repBound, double drawEquivalentWinsForWhite); 17 | } 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /cpp/neuralnet/activations.h: -------------------------------------------------------------------------------- 1 | #ifndef NEURALNET_ACTIVATIONS_H 2 | #define NEURALNET_ACTIVATIONS_H 3 | 4 | static constexpr int ACTIVATION_IDENTITY = 0; 5 | static constexpr int ACTIVATION_RELU = 1; 6 | static constexpr int ACTIVATION_MISH = 2; 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /cpp/neuralnet/cudaincludes.h: -------------------------------------------------------------------------------- 1 | #ifndef NEURALNET_CUDAINCLUDES_H 2 | #define NEURALNET_CUDAINCLUDES_H 3 | 4 | //Ensure that CUDA_API_PER_THREAD_DEFAULT_STREAM is always defined 5 | //before any cuda headers are included so that we get the desired threading behavior for CUDA. 6 | 7 | #define CUDA_API_PER_THREAD_DEFAULT_STREAM 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | 15 | #endif //NEURALNET_CUDAINCLUDES_H 16 | -------------------------------------------------------------------------------- /cpp/neuralnet/cudautils.h: -------------------------------------------------------------------------------- 1 | #ifndef NEURALNET_CUDAUTILS_H 2 | #define NEURALNET_CUDAUTILS_H 3 | 4 | #include "../core/global.h" 5 | 6 | namespace CudaUtils { 7 | void mallocOnDevice(const std::string& name, int numWeights, void*& deviceBuf, bool useFP16); 8 | void mallocAndCopyToDevice(const std::string& name, const std::vector& weights, void*& deviceBuf, bool useFP16); 9 | void mallocAndCopyToDevice(const std::string& name, const float* weights, int numWeights, void*& deviceBuf, bool useFP16); 10 | 11 | //Only use in testing, allocates an intermediate buffer in the case of FP16 which will be very slow. 12 | void expensiveCopyFromDevice(const std::string& name, float* weights, int numWeights, const void* deviceBuf, bool useFP16); 13 | 14 | void debugPrint2D(const std::string& name, const void* deviceBuf, int batchSize, int cSize, bool useFP16); 15 | void debugPrint4D(const std::string& name, const void* deviceBuf, int batchSize, int cSize, int xSize, int ySize, bool useNHWC, bool useFP16); 16 | 17 | void checkBufferSize(int batchSize, int xSize, int ySize, int channels); 18 | void hostMallocZeroOneBufs(void*& zeroBuf, void*& oneBuf, bool useFP16); 19 | } 20 | 21 | #endif // NEURALNET_CUDAUTILS_H 22 | -------------------------------------------------------------------------------- /cpp/neuralnet/modelversion.h: -------------------------------------------------------------------------------- 1 | #ifndef NEURALNET_MODELVERSION_H_ 2 | #define NEURALNET_MODELVERSION_H_ 3 | 4 | // Model versions 5 | namespace NNModelVersion { 6 | 7 | constexpr int latestModelVersionImplemented = 16; 8 | constexpr int latestInputsVersionImplemented = 7; 9 | constexpr int defaultModelVersion = 16; 10 | 11 | constexpr int oldestModelVersionImplemented = 3; 12 | constexpr int oldestInputsVersionImplemented = 3; 13 | 14 | // Which V* feature version from NNInputs does a given model version consume? 15 | int getInputsVersion(int modelVersion); 16 | 17 | // Convenience functions, feeds forward the number of features and the size of 18 | // the row vector that the net takes as input 19 | int getNumSpatialFeatures(int modelVersion); 20 | int getNumGlobalFeatures(int modelVersion); 21 | 22 | // SGF metadata encoder input versions 23 | int getNumInputMetaChannels(int metaEncoderVersion); 24 | 25 | } // namespace NNModelVersion 26 | 27 | #endif // NEURALNET_MODELVERSION_H_ 28 | -------------------------------------------------------------------------------- /cpp/neuralnet/openclincludes.h: -------------------------------------------------------------------------------- 1 | #ifndef NEURALNET_OPENCLINCLUDES_H 2 | #define NEURALNET_OPENCLINCLUDES_H 3 | 4 | //Ensures a consistent opencl version everywhere we include opencl 5 | #define CL_TARGET_OPENCL_VERSION 120 6 | #define CL_USE_DEPRECATED_OPENCL_1_2_APIS 7 | 8 | #ifdef __APPLE__ 9 | #include 10 | #else 11 | #include 12 | #endif 13 | 14 | 15 | #endif //NEURALNET_OPENCLINCLUDES_H 16 | -------------------------------------------------------------------------------- /cpp/neuralnet/openclkernels.h: -------------------------------------------------------------------------------- 1 | #ifndef NEURALNET_OPENCL_KERNELS_H 2 | #define NEURALNET_OPENCL_KERNELS_H 3 | 4 | #include "../core/global.h" 5 | 6 | namespace OpenCLKernels { 7 | extern std::string fp16StorageDefine; 8 | extern std::string fp16ComputeDefine; 9 | extern std::string actIdenDefine; 10 | extern std::string actReluDefine; 11 | extern std::string actMishDefine; 12 | 13 | extern std::string common; 14 | extern std::string conv2dNCHW; 15 | extern std::string winogradTransformNCHW; 16 | extern std::string winogradBNActTransformNCHW; 17 | extern std::string winogradUntransformNCHW; 18 | extern std::string scaleBiasMaskActNCHW; 19 | extern std::string addPointWise; 20 | extern std::string matMul; 21 | extern std::string matMulTransBatched; 22 | extern std::string sumChannelsNCHW; 23 | extern std::string gPoolChannelsNCHWMask; 24 | extern std::string valueHeadPoolChannelsNCHW; 25 | extern std::string addChannelBiasesNCHW; 26 | extern std::string addCBiasesNCAct; 27 | extern std::string extractChannel0NCHW; 28 | 29 | extern std::string xgemmDirect; 30 | extern std::string xgemm; 31 | extern std::string hgemmWmma; 32 | extern std::string hgemmWmmaNCHW; 33 | } 34 | 35 | 36 | 37 | 38 | 39 | #endif //NEURALNET_OPENCL_KERNELS_H 40 | -------------------------------------------------------------------------------- /cpp/neuralnet/sgfmetadata.h: -------------------------------------------------------------------------------- 1 | #ifndef NEURALNET_SGFMETADATA_H_ 2 | #define NEURALNET_SGFMETADATA_H_ 3 | 4 | #include 5 | 6 | #include "../core/datetime.h" 7 | #include "../core/hash.h" 8 | #include "../game/board.h" 9 | 10 | struct SGFMetadata { 11 | bool initialized = false; 12 | 13 | int inverseBRank = 0; // KG = 0, 9d = 1, 8d = 2,... 1d = 9, 1k = 10, 2k = 11, ... 14 | int inverseWRank = 0; 15 | bool bIsUnranked = false; // KGS "-" rank 16 | bool wIsUnranked = false; 17 | bool bRankIsUnknown = false; // No rank in file 18 | bool wRankIsUnknown = false; 19 | bool bIsHuman = false; 20 | bool wIsHuman = false; 21 | 22 | bool gameIsUnrated = false; 23 | bool gameRatednessIsUnknown = false; 24 | 25 | //One-hot for all things with metadata 26 | bool tcIsUnknown = false; 27 | bool tcIsNone = false; 28 | bool tcIsAbsolute = false; 29 | bool tcIsSimple = false; 30 | bool tcIsByoYomi = false; 31 | bool tcIsCanadian = false; 32 | bool tcIsFischer = false; 33 | 34 | double mainTimeSeconds = 0.0; 35 | double periodTimeSeconds = 0.0; 36 | int byoYomiPeriods = 0; 37 | int canadianMoves = 0; 38 | 39 | SimpleDate gameDate; 40 | 41 | int source = 0; 42 | static const int SOURCE_OGS = 1; 43 | static const int SOURCE_KGS = 2; 44 | static const int SOURCE_FOX = 3; 45 | static const int SOURCE_TYGEM = 4; 46 | static const int SOURCE_GOGOD = 5; 47 | static const int SOURCE_GO4GO = 6; 48 | 49 | static constexpr int METADATA_INPUT_NUM_CHANNELS = 192; 50 | 51 | bool operator==(const SGFMetadata& other) const; 52 | bool operator!=(const SGFMetadata& other) const; 53 | 54 | Hash128 getHash(Player nextPlayer) const; 55 | 56 | static void fillMetadataRow(const SGFMetadata* sgfMeta, float* rowMetadata, Player nextPlayer, int boardArea); 57 | 58 | static SGFMetadata getProfile(const std::string& humanSLProfileName); 59 | }; 60 | 61 | #endif // NEURALNET_SGFMETADATA_H_ 62 | -------------------------------------------------------------------------------- /cpp/program/gitinfotemplate.h: -------------------------------------------------------------------------------- 1 | #define STRINGIFY_GIT_REV(x) #x 2 | #define STRINGIFY_GIT_REV2(x) STRINGIFY_GIT_REV(x) 3 | #define GIT_REVISION STRINGIFY_GIT_REV2(GIT_REVISION_) 4 | #define GIT_REVISION_ \ 5 | -------------------------------------------------------------------------------- /cpp/program/gtpconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef GTP_CONFIG_H_ 2 | #define GTP_CONFIG_H_ 3 | 4 | #include "../core/global.h" 5 | #include "../game/boardhistory.h" 6 | 7 | namespace GTPConfig { 8 | std::string makeConfig( 9 | const Rules& rules, 10 | int64_t maxVisits, 11 | int64_t maxPlayouts, 12 | double maxTime, 13 | double maxPonderTime, 14 | std::vector deviceIdxs, 15 | int nnCacheSizePowerOfTwo, 16 | int nnMutexPoolSizePowerOfTwo, 17 | int numSearchThreads 18 | ); 19 | } 20 | 21 | #endif //GTP_CONFIG_H_ 22 | -------------------------------------------------------------------------------- /cpp/runoutputtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | { 3 | ./katago runoutputtests | tee tests/results/runOutputTests.txt 4 | 5 | exit 0 6 | } 7 | -------------------------------------------------------------------------------- /cpp/runsearchtestslimited.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | set -o pipefail 3 | { 4 | ./katago runsearchtests tests/models/g103-b6c96-s103408384-d26419149.txt.gz false false 0 false | tee tests/results/runSearchTests-iNCHW-cNCHW.txt 5 | ./katago runsearchtests tests/models/run4-s67105280-d24430742-b6c96.txt.gz false false 0 false | tee tests/results/runSearchTests-r4-iNCHW-cNCHW.txt 6 | ./katago runsearchtestsv3 tests/models/grun2-b6c96-s128700160-d49811312.txt.gz false false 0 false | tee tests/results/runSearchTestsV3-g2-iNCHW-cNCHW.txt 7 | ./katago runsearchtestsv3 tests/models/grun2-b6c96-s128700160-d49811312.txt.gz false false 5 false | tee tests/results/runSearchTestsV3-g2-s5.txt 8 | ./katago runnnsymmetriestest tests/models/g103-b6c96-s103408384-d26419149.txt.gz false false false | tee tests/results/runNNSymmetriesTest.txt 9 | ./katago runsearchtestsv8 tests/models/g170-b6c96-s175395328-d26788732.txt.gz false false false | tee tests/results/runSearchTestsV8.txt 10 | ./katago runsearchtestsv9 tests/models/g170-b6c96-s175395328-d26788732.txt.gz false false false | tee tests/results/runSearchTestsV9.txt 11 | 12 | ./katago runselfplayinittests tests/models/grun50-b6c96-s156348160-d118286860.txt.gz | tee tests/results/runSelfplayInitTests.txt 13 | ./katago runsekitrainwritetests tests/models/g103-b6c96-s103408384-d26419149.txt.gz | tee tests/results/runSekiTrainWriteTests.txt 14 | ./katago runnnsymmetriestest tests/models/g103-b6c96-s103408384-d26419149.txt.gz false false false | tee tests/results/runNNSymmetriesTest.txt 15 | ./katago runselfplayinitstattests tests/models/g170-b6c96-s175395328-d26788732.bin.gz | tee tests/results/runSelfplayInitStatTests.txt 16 | 17 | mkdir -p tests/scratch 18 | ./katago runtinynntests tests/scratch 1.0 | grep -v ': nnRandSeed0 = ' | grep -v 'finishing, processed' | tee tests/results/runTinyNNTests.txt 19 | 20 | exit 0 21 | } 22 | -------------------------------------------------------------------------------- /cpp/search/distributiontable.cpp: -------------------------------------------------------------------------------- 1 | #include "../search/distributiontable.h" 2 | 3 | using namespace std; 4 | 5 | DistributionTable::DistributionTable(function pdf, function cdf, double minz, double maxz, int sz) { 6 | size = sz; 7 | minZ = minz; 8 | maxZ = maxz; 9 | pdfTable = new double[size]; 10 | cdfTable = new double[size]; 11 | 12 | for(int i = 0; i pdf, std::function cdf, double minZ, double maxZ, int size); 14 | ~DistributionTable(); 15 | 16 | DistributionTable(const DistributionTable& other) = delete; 17 | DistributionTable& operator=(const DistributionTable& other) = delete; 18 | 19 | inline void getPdfCdf(double z, double& pdf, double& cdf) const { 20 | double d = (size-1) * (z-minZ) / (maxZ-minZ); 21 | if(d <= 0) { 22 | pdf = 0.0; 23 | cdf = 0.0; 24 | return; 25 | } 26 | int idx = (int)d; 27 | if(idx >= size-1) { 28 | pdf = 0.0; 29 | cdf = 1.0; 30 | return; 31 | } 32 | double lambda = d - idx; 33 | double yp0 = pdfTable[idx]; 34 | double yp1 = pdfTable[idx+1]; 35 | double yc0 = cdfTable[idx]; 36 | double yc1 = cdfTable[idx+1]; 37 | pdf = yp0 + lambda * (yp1 - yp0); 38 | cdf = yc0 + lambda * (yc1 - yc0); 39 | }; 40 | 41 | inline double getPdf(double z) const { 42 | double d = (size-1) * (z-minZ) / (maxZ-minZ); 43 | if(d <= 0) 44 | return 0.0; 45 | int idx = (int)d; 46 | if(idx >= size-1) 47 | return 0.0; 48 | double lambda = d - idx; 49 | double y0 = pdfTable[idx]; 50 | double y1 = pdfTable[idx+1]; 51 | return y0 + lambda * (y1 - y0); 52 | }; 53 | 54 | inline double getCdf(double z) const { 55 | double d = (size-1) * (z-minZ) / (maxZ-minZ); 56 | if(d <= 0) 57 | return 0.0; 58 | int idx = (int)d; 59 | if(idx >= size-1) 60 | return 1.0; 61 | double lambda = d - idx; 62 | double y0 = cdfTable[idx]; 63 | double y1 = cdfTable[idx+1]; 64 | return y0 + lambda * (y1 - y0); 65 | }; 66 | }; 67 | 68 | 69 | #endif // SEARCH_DISTRIBUTION_TABLE_H_ 70 | -------------------------------------------------------------------------------- /cpp/search/localpattern.h: -------------------------------------------------------------------------------- 1 | #ifndef SEARCH_LOCALPATTERN_H 2 | #define SEARCH_LOCALPATTERN_H 3 | 4 | #include "../core/global.h" 5 | #include "../core/hash.h" 6 | #include "../core/rand.h" 7 | #include "../game/board.h" 8 | 9 | struct LocalPatternHasher { 10 | int xSize; 11 | int ySize; 12 | std::vector zobristLocalPattern; 13 | std::vector zobristPla; 14 | std::vector zobristAtari; 15 | 16 | LocalPatternHasher(); 17 | ~LocalPatternHasher(); 18 | 19 | void init(int xSize, int ySize, Rand& rand); 20 | 21 | Hash128 getHash(const Board& board, Loc loc, Player pla) const; 22 | 23 | //Returns the hash that would occur if symmetry were applied to both board and loc. 24 | //So basically, the only thing that changes is the zobrist indexing. 25 | Hash128 getHashWithSym(const Board& board, Loc loc, Player pla, int symmetry, bool flipColors) const; 26 | }; 27 | 28 | #endif //SEARCH_LOCALPATTERN_H 29 | -------------------------------------------------------------------------------- /cpp/search/mutexpool.cpp: -------------------------------------------------------------------------------- 1 | #include "../search/mutexpool.h" 2 | 3 | using namespace std; 4 | 5 | MutexPool::MutexPool(uint32_t n) { 6 | numMutexes = n; 7 | mutexes = new mutex[n]; 8 | } 9 | 10 | MutexPool::~MutexPool() { 11 | delete[] mutexes; 12 | } 13 | 14 | uint32_t MutexPool::getNumMutexes() const { 15 | return numMutexes; 16 | } 17 | 18 | mutex& MutexPool::getMutex(uint32_t idx) { 19 | return mutexes[idx]; 20 | } 21 | -------------------------------------------------------------------------------- /cpp/search/mutexpool.h: -------------------------------------------------------------------------------- 1 | #ifndef SEARCH_MUTEXPOOL_H_ 2 | #define SEARCH_MUTEXPOOL_H_ 3 | 4 | #include "../core/global.h" 5 | #include "../core/multithread.h" 6 | 7 | class MutexPool { 8 | std::mutex* mutexes; 9 | uint32_t numMutexes; 10 | 11 | public: 12 | MutexPool(uint32_t n); 13 | ~MutexPool(); 14 | 15 | uint32_t getNumMutexes() const; 16 | std::mutex& getMutex(uint32_t idx); 17 | }; 18 | 19 | #endif // SEARCH_MUTEXPOOL_H_ 20 | -------------------------------------------------------------------------------- /cpp/search/reportedsearchvalues.h: -------------------------------------------------------------------------------- 1 | #ifndef SEARCH_REPORTEDSEARCHVALUES_H_ 2 | #define SEARCH_REPORTEDSEARCHVALUES_H_ 3 | 4 | #include "../core/global.h" 5 | 6 | struct Search; 7 | 8 | struct ReportedSearchValues { 9 | double winValue; 10 | double lossValue; 11 | double noResultValue; 12 | double staticScoreValue; 13 | double dynamicScoreValue; 14 | double expectedScore; 15 | double expectedScoreStdev; 16 | double lead; 17 | double winLossValue; 18 | double utility; 19 | double weight; 20 | int64_t visits; 21 | 22 | ReportedSearchValues(); 23 | ReportedSearchValues( 24 | const Search& search, 25 | double winLossValueAvg, 26 | double noResultValueAvg, 27 | double scoreMeanAvg, 28 | double scoreMeanSqAvg, 29 | double leadAvg, 30 | double utilityAvg, 31 | double totalWeight, 32 | int64_t totalVisits 33 | ); 34 | ~ReportedSearchValues(); 35 | 36 | friend std::ostream& operator<<(std::ostream& out, const ReportedSearchValues& values); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /cpp/search/searchnodetable.cpp: -------------------------------------------------------------------------------- 1 | #include "../search/searchnodetable.h" 2 | 3 | #include "../core/rand.h" 4 | #include "../search/localpattern.h" 5 | 6 | SearchNodeTable::SearchNodeTable(int numShardsPowerOfTwo) { 7 | numShards = (uint32_t)1 << numShardsPowerOfTwo; 8 | mutexPool = new MutexPool(numShards); 9 | entries.resize(numShards); 10 | } 11 | SearchNodeTable::~SearchNodeTable() { 12 | delete mutexPool; 13 | } 14 | 15 | uint32_t SearchNodeTable::getIndex(uint64_t hash) const { 16 | uint32_t mutexPoolMask = numShards-1; //Always a power of two 17 | return (uint32_t)(hash & mutexPoolMask); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /cpp/search/searchnodetable.h: -------------------------------------------------------------------------------- 1 | #ifndef SEARCH_SEARCHNODETABLE_H 2 | #define SEARCH_SEARCHNODETABLE_H 3 | 4 | #include "../core/global.h" 5 | #include "../core/hash.h" 6 | #include "../core/multithread.h" 7 | #include "../game/board.h" 8 | #include "../search/mutexpool.h" 9 | 10 | struct SearchNode; 11 | 12 | struct SearchNodeTable { 13 | std::vector> entries; 14 | MutexPool* mutexPool; 15 | uint32_t numShards; 16 | 17 | SearchNodeTable(int numShardsPowerOfTwo); 18 | ~SearchNodeTable(); 19 | 20 | uint32_t getIndex(uint64_t hash) const; 21 | }; 22 | 23 | #endif 24 | 25 | 26 | -------------------------------------------------------------------------------- /cpp/search/searchprint.cpp: -------------------------------------------------------------------------------- 1 | #include "../search/searchprint.h" 2 | -------------------------------------------------------------------------------- /cpp/search/searchpuct.cpp: -------------------------------------------------------------------------------- 1 | #include "../search/search.h" 2 | 3 | #include "../search/searchnode.h" 4 | 5 | //------------------------ 6 | #include "../core/using.h" 7 | //------------------------ 8 | 9 | 10 | -------------------------------------------------------------------------------- /cpp/search/subtreevaluebiastable.h: -------------------------------------------------------------------------------- 1 | #ifndef SEARCH_SUBTREEVALUEBIASTABLE_H 2 | #define SEARCH_SUBTREEVALUEBIASTABLE_H 3 | 4 | #include "../core/global.h" 5 | #include "../core/hash.h" 6 | #include "../core/multithread.h" 7 | #include "../game/board.h" 8 | #include "../search/mutexpool.h" 9 | 10 | struct SubtreeValueBiasEntry { 11 | double deltaUtilitySum = 0.0; 12 | double weightSum = 0.0; 13 | mutable std::atomic_flag entryLock = ATOMIC_FLAG_INIT; 14 | }; 15 | 16 | struct SubtreeValueBiasTable { 17 | std::vector>> entries; 18 | MutexPool* mutexPool; 19 | 20 | SubtreeValueBiasTable(int32_t numShards); 21 | ~SubtreeValueBiasTable(); 22 | 23 | // ASSUMES there is no concurrent multithreading of this table or any of its entries, 24 | // and that all past mutations on this table or any of its entries are now visible to this thread. 25 | void clearUnusedSynchronous(); 26 | 27 | // The board specified here is expected to be the board BEFORE the move is played. 28 | std::shared_ptr get(Player pla, Loc parentPrevMoveLoc, Loc prevMoveLoc, const Board& prevBoard); 29 | }; 30 | 31 | #endif 32 | 33 | 34 | -------------------------------------------------------------------------------- /cpp/tests/analysis/badoverride.txt: -------------------------------------------------------------------------------- 1 | {"id":"badoverride","initialStones":[],"moves":[],"rules":"tromp-taylor","komi":7.5,"boardXSize":19,"boardYSize":19,"overrideSettings":{"sldjfslkjf":1234}} 2 | {"id":"badfield","initialStones":[],"moves":[],"rules":"tromp-taylor","komi":7.5,"boardXSize":19,"boardYSize":19,"overrideSettings":{},"myUnusedField":3,"boardxsize":13} 3 | -------------------------------------------------------------------------------- /cpp/tests/analysis/basic.txt: -------------------------------------------------------------------------------- 1 | {"id":"foo","initialStones":[["B","Q4"],["B","C4"]],"moves":[["W","P5"],["B","P6"]],"rules":"tromp-taylor","komi":7.5,"boardXSize":19,"boardYSize":19,"analyzeTurns":[2],"overrideSettings":{"maxVisits":10}} 2 | {"id":"foo","initialStones":[],"moves":[["W","C5"],["B","C6"]],"rules":"tromp-taylor","komi":4,"boardXSize":7,"boardYSize":7,"overrideSettings":{"maxVisits":10},"includeOwnership":true,"includePolicy":true} 3 | {"id":"foo","initialStones":[],"moves":[["W","C5"],["B","C6"],["W","C7"]],"rules":"tromp-taylor","komi":4,"boardXSize":7,"boardYSize":7,"overrideSettings":{"maxVisits":10},"includeOwnership":true,"includePolicy":true} 4 | {"id":"foo","initialStones":[],"moves":[["W","C5"],["B","C6"],["W","C7"]],"rules":"tromp-taylor","komi":4,"boardXSize":7,"boardYSize":7,"overrideSettings":{"maxVisits":20},"includeOwnership":true,"includeOwnershipStdev":true,"includePolicy":true} 5 | 6 | -------------------------------------------------------------------------------- /cpp/tests/analysis/pvvisits.txt: -------------------------------------------------------------------------------- 1 | {"id":"pvvisittest","initialStones":[],"moves":[["B","D4"],["W","D5"],["B","C5"],["W","E4"],["B","D3"],["W","C6"],["B","E5"],["W","D6"]],"rules":"tromp-taylor","komi":9,"boardXSize":7,"boardYSize":7,"overrideSettings":{"maxVisits":1000},"includePVVisits":true} 2 | {"id":"pvvisittest","initialStones":[],"moves":[["B","D4"],["W","D5"],["B","C5"],["W","E4"],["B","D3"],["W","E5"],["B","C6"],["W","E3"],["B","E2"],["W","F2"],["B","D2"],["W","C4"],["B","D6"],["W","B4"]],"rules":"chinese","komi":9,"boardXSize":7,"boardYSize":7,"overrideSettings":{"maxVisits":1000},"includePVVisits":true} 3 | -------------------------------------------------------------------------------- /cpp/tests/analysis/symmetry.txt: -------------------------------------------------------------------------------- 1 | {"id":"empty","initialStones":[],"moves":[],"rules":"tromp-taylor","komi":7.5,"boardXSize":19,"boardYSize":19,"overrideSettings":{"maxVisits":10}} 2 | {"id":"diag","initialStones":[],"moves":[["B","D4"]],"rules":"tromp-taylor","komi":7.5,"boardXSize":19,"boardYSize":19,"overrideSettings":{"maxVisits":10}} 3 | {"id":"nosym","initialStones":[],"moves":[["B","D3"]],"rules":"tromp-taylor","komi":7.5,"boardXSize":19,"boardYSize":19,"overrideSettings":{"maxVisits":10}} 4 | {"id":"rect","initialStones":[],"moves":[],"rules":"tromp-taylor","komi":7.5,"boardXSize":13,"boardYSize":7,"overrideSettings":{"maxVisits":10},"includeMovesOwnership":true,"includeOwnership":true} 5 | {"id":"rect2","initialStones":[],"moves":[],"rules":"tromp-taylor","komi":7.5,"boardXSize":7,"boardYSize":13,"overrideSettings":{"maxVisits":10},"includeMovesOwnership":true,"includeOwnership":true} 6 | {"id":"rect3","initialStones":[],"moves":[],"rules":"tromp-taylor","komi":7.5,"boardXSize":7,"boardYSize":13,"overrideSettings":{"maxVisits":20},"includeMovesOwnership":true,"includeOwnership":true} 7 | {"id":"rect4","initialStones":[],"moves":[],"rules":"tromp-taylor","komi":7.5,"boardXSize":7,"boardYSize":13,"overrideSettings":{"maxVisits":20},"includeMovesOwnershipStdev":true,"includeOwnershipStdev":true} 8 | 9 | 10 | -------------------------------------------------------------------------------- /cpp/tests/data/configs/folded/test-parent.cfg: -------------------------------------------------------------------------------- 1 | # Config for inclusion files from parent dirs 2 | 3 | @include ../test.cfg 4 | 5 | param = value 6 | -------------------------------------------------------------------------------- /cpp/tests/data/configs/matchtest.cfg: -------------------------------------------------------------------------------- 1 | 2 | logTimeStamp = false 3 | logSearchInfo = false 4 | logMoves = false 5 | logGamesEvery = 20 6 | logToStdout = true 7 | 8 | numBots=8 9 | includeBots = 0,1,2,3,4 10 | secondaryBots = 2,3,4 11 | extraPairs = 2-0,2-4,1-5,7-5 12 | 13 | botName0=AAA 14 | botName1=BBB 15 | botName2=CCC 16 | botName3=DDD 17 | botName4=EEE 18 | botName5=FFF 19 | botName6=GGG 20 | botName7=HHH 21 | 22 | nnModelFile0=MODELB 23 | nnModelFile1=MODELA 24 | nnModelFile2=MODELA 25 | nnModelFile3=MODELC 26 | nnModelFile4=MODELA 27 | nnModelFile5=MODELC 28 | nnModelFile6=MODELD 29 | nnModelFile7=MODELE 30 | 31 | debugSkipNeuralNet = true 32 | maxPlayouts = 10 33 | 34 | numGameThreads=1 35 | numGamesTotal=44 36 | maxMovesPerGame=2 37 | 38 | allowResignation = true 39 | resignThreshold = -0.95 40 | resignConsecTurns = 3 41 | 42 | koRules = SIMPLE 43 | scoringRules = AREA 44 | taxRules = NONE 45 | multiStoneSuicideLegals = false 46 | hasButtons = false 47 | bSizes = 9 48 | bSizeRelProbs = 1 49 | 50 | komiMean = 7 51 | handicapProb = 0.0 52 | handicapCompensateKomiProb = 1.0 53 | 54 | numSearchThreads = 1 55 | 56 | nnMaxBatchSize = 64 57 | nnCacheSizePowerOfTwo = 15 58 | nnMutexPoolSizePowerOfTwo = 10 59 | nnRandomize = true 60 | 61 | numNNServerThreadsPerModel = 1 62 | 63 | -------------------------------------------------------------------------------- /cpp/tests/data/configs/matchtest2.cfg: -------------------------------------------------------------------------------- 1 | 2 | logTimeStamp = false 3 | logSearchInfo = false 4 | logMoves = false 5 | logGamesEvery = 20 6 | logToStdout = true 7 | 8 | numBots=8 9 | includeBots = 0,1,2,3,4 10 | secondaryBots = 2,3,4 11 | extraPairs = 2-0,2-4,1-5,7-5 12 | extraPairsAreOneSidedBW = true 13 | 14 | botName0=AAA 15 | botName1=BBB 16 | botName2=CCC 17 | botName3=DDD 18 | botName4=EEE 19 | botName5=FFF 20 | botName6=GGG 21 | botName7=HHH 22 | 23 | nnModelFile0=MODELB 24 | nnModelFile1=MODELA 25 | nnModelFile2=MODELA 26 | nnModelFile3=MODELC 27 | nnModelFile4=MODELA 28 | nnModelFile5=MODELC 29 | nnModelFile6=MODELD 30 | nnModelFile7=MODELE 31 | 32 | debugSkipNeuralNet = true 33 | maxPlayouts = 10 34 | 35 | numGameThreads=1 36 | numGamesTotal=36 37 | maxMovesPerGame=2 38 | 39 | allowResignation = true 40 | resignThreshold = -0.95 41 | resignConsecTurns = 3 42 | 43 | koRules = SIMPLE 44 | scoringRules = AREA 45 | taxRules = NONE 46 | multiStoneSuicideLegals = false 47 | hasButtons = false 48 | bSizes = 9 49 | bSizeRelProbs = 1 50 | 51 | komiMean = 7 52 | handicapProb = 0.0 53 | handicapCompensateKomiProb = 1.0 54 | 55 | numSearchThreads = 1 56 | 57 | nnMaxBatchSize = 64 58 | nnCacheSizePowerOfTwo = 15 59 | nnMutexPoolSizePowerOfTwo = 10 60 | nnRandomize = true 61 | 62 | numNNServerThreadsPerModel = 1 63 | 64 | -------------------------------------------------------------------------------- /cpp/tests/data/configs/test-circular0.cfg: -------------------------------------------------------------------------------- 1 | # Config for circular inclusion test 2 | 3 | @include test-circular1.cfg 4 | 5 | param = value 6 | -------------------------------------------------------------------------------- /cpp/tests/data/configs/test-circular1.cfg: -------------------------------------------------------------------------------- 1 | # Config for circular inclusion test 2 | 3 | @include test-circular0.cfg 4 | -------------------------------------------------------------------------------- /cpp/tests/data/configs/test-duplicate.cfg: -------------------------------------------------------------------------------- 1 | # Duplicate parameters in the same config test 2 | 3 | logDir = analysis_logs # Each run of KataGo will log to a separate file in this dir 4 | logDir = more_logs # try duplicate 5 | nnMaxBatchSize = 100500 # try override 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cpp/tests/data/configs/test.cfg: -------------------------------------------------------------------------------- 1 | # General config test with included file 2 | 3 | @include test1.cfg 4 | 5 | logDir = more_logs # try duplicate 6 | nnMaxBatchSize = 100500 # try override 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /cpp/tests/data/configs/test1.cfg: -------------------------------------------------------------------------------- 1 | @include folded/analysis_example.cfg 2 | 3 | maxVisits = 1000 4 | nnMaxBatchSize = 100 # try override 5 | -------------------------------------------------------------------------------- /cpp/tests/data/configs/test2.cfg: -------------------------------------------------------------------------------- 1 | nnMaxBatchSize = 100 # try override 2 | -------------------------------------------------------------------------------- /cpp/tests/data/cornermoves.sgf: -------------------------------------------------------------------------------- 1 | (;GM[1]FF[4]CA[UTF-8]AP[CGoban:3]ST[2] 2 | RU[Japanese]SZ[19]KM[6.50] 3 | PW[White]PB[Black] 4 | ;B[pd] 5 | ;W[pq] 6 | ;B[cq] 7 | ;W[de]) 8 | -------------------------------------------------------------------------------- /cpp/tests/data/foxlike.sgf: -------------------------------------------------------------------------------- 1 | (;GM[1]FF[4] SZ[19] GN[] DT[2021-01-01] PB[testname1] PW[testname2] BR[3段] WR[5段] KM[325]HA[2]RU[Chinese]AP[GNU Go:3.8]RE[draw]TM[60]TC[10]TT[60]AP[foxwq]RL[0] ;AB[pd][dp];W[dc];B[ce];) -------------------------------------------------------------------------------- /cpp/tests/data/humanslbigdiff.sgf: -------------------------------------------------------------------------------- 1 | (;KM[7.5]SZ[19];B[qd];W[dd];B[pq];W[dp];B[fc];W[df];B[fq];W[ic];B[cn];W[oc];B[od];W[nd];B[nc];W[mc];B[nb];W[mb];B[ob];W[pc];B[pb];W[qc];B[pd];W[qb];B[rb];W[cl];B[eo];W[do];B[dn];W[en];B[fo];W[dm];B[bn];W[eq];B[cq];W[bo];B[bp];W[co];B[ao];W[fr];B[gq];W[dr];B[cr];W[gr];B[iq];W[hr];B[hq];W[rc];B[qa];W[br];B[bs];W[ir];B[jr];W[ar];B[an];W[fn];B[go];W[bl];B[ds];W[es];B[cs];W[dq];B[cp];W[ap];B[aq];W[kr];B[jq];W[js];B[lq];W[am];B[md];W[ne];B[ld];W[kc];B[kd];W[kb];B[rd];W[dc];B[lr];W[cm];B[pk];W[bm];B[ap];W[bq];B[as];W[br];B[ep];W[er];B[gn];W[fl];B[gl];W[qp];B[qq]) -------------------------------------------------------------------------------- /cpp/tests/data/sampletest/sampletest7x7.sgf: -------------------------------------------------------------------------------- 1 | (;GM[1]FF[4]CA[UTF-8]AP[CGoban:3]ST[2]RU[Japanese]SZ[7]KM[7.5]PW[White]PB[Black];B[dd];W[dc];B[ec];W[cd];B[de];W[cc];B[eb];W[ce];B[cf];W[bf];B[df];W[ed](;B[fd];W[ee];B[ef];W[fe];B[ff];W[db];B[bg];W[ea](;B[be];W[fc];B[ge];W[fb])(;B[fa];W[da]))(;B[db];W[fd];B[ee];W[fe];B[ff])) -------------------------------------------------------------------------------- /cpp/tests/data/sampletest/sampletest9x9.sgf: -------------------------------------------------------------------------------- 1 | (;GM[1]FF[4]CA[UTF-8]AP[CGoban:3]ST[2]RU[Japanese]SZ[9]KM[6]PW[White]PB[Black]AW[de][ef][ff][gg][hg]AB[dc][dd][fe][ge][gf];B[ce];W[cf](;B[be];W[bf];B[fg];W[fh];B[eg];W[dg];B[hf];W[hd];B[ie];W[fc](;B[gb];W[bc];B[cd](;W[gc];B[ec];W[fb];B[hb];W[hc];B[ea];W[ib];B[ha];W[fa];B[ee];W[df];B[id];W[he];B[da];W[ed];B[fd];W[cb];B[ba];W[ca];B[bd];W[ic];B[if];W[ab])(;W[db];B[cb];W[eb];B[hc](;W[ad];B[ae];W[cc];B[bb];W[ed];B[ee];W[df];B[bd];W[gd];B[id];W[fb];B[ha];W[ib])(;AE[hc]AW[df][dh][eh]AB[ee][dg]C[%SAMPLE%]PL[B];B[hc];W[ad];B[ae];W[cc];B[bb])))(;B[cg]C[%HINT%]))(;B[ia]C[%HINT%])) -------------------------------------------------------------------------------- /cpp/tests/data/sampletest2/messy.sgf: -------------------------------------------------------------------------------- 1 | (;GM[1]FF[4]CA[UTF-8]AP[CGoban:3]ST[2] 2 | RU[Japanese]SZ[9]KM[6.00] 3 | PW[White]PB[Black] 4 | (;B[fd] 5 | ;W[df] 6 | (;B[ff] 7 | ;W[dd] 8 | ;B[dg]) 9 | (;B[] 10 | ;W[dd]C[%NOSAMPLE%] 11 | ;B[ff]C[%SAMPLELIGHT%] 12 | ;W[ec] 13 | (;AW[de]AB[fe]PL[W] 14 | ;W[gb]C[%HINT%] 15 | ;B[hd]) 16 | (;AE[df]AB[ce]PL[B] 17 | ;B[de]) 18 | (;B[dg] 19 | ;W[cg] 20 | ;B[eg] 21 | ;W[ch]C[%HINT%]))) 22 | (;AB[cc][gc][cg][gg] 23 | ;PL[W]) 24 | (;B[ia] 25 | ;W[ib] 26 | ;W[ic] 27 | ;W[id]C[%SAMPLE%] 28 | ;W[ie]C[%HINTLIGHT% 29 | not caught due to too few stones] 30 | ;W[if] 31 | ;W[ig]C[%HINTLIGHT%] 32 | ;W[ih] 33 | ;B[ii] 34 | ;W[hi] 35 | ;B[gi]C[%HINTLIGHT%] 36 | ;W[fi])) 37 | -------------------------------------------------------------------------------- /cpp/tests/gtp/basic.txt: -------------------------------------------------------------------------------- 1 | genmove_debug b 2 | genmove_debug w 3 | clear_board 4 | genmove_debug b 5 | genmove_debug w 6 | boardsize 9 7 | genmove_debug b 8 | showboard 9 | kata-search w 10 | kata-search b 11 | kata-search_debug w 12 | kata-search_debug b 13 | -------------------------------------------------------------------------------- /cpp/tests/gtp/ending.txt: -------------------------------------------------------------------------------- 1 | boardsize 7 2 | kata-set-rules chinese 3 | set_position w d7 b e7 b f7 w b6 w d6 w e6 b f6 b b5 w c5 w d5 b e5 w b4 w c4 b e4 b b3 w c3 b d3 b e3 w f3 b g3 w a2 w b2 b c2 b d2 b f2 b b1 4 | komi 5 5 | genmove_debug b 6 | genmove_debug w 7 | genmove_debug b 8 | genmove_debug w 9 | play b pass 10 | genmove_debug w 11 | showboard 12 | final_status_list alive 13 | final_status_list dead 14 | final_score 15 | genmove_debug b 16 | undo 17 | play b pass 18 | showboard 19 | final_status_list alive 20 | final_status_list dead 21 | final_score 22 | 23 | kata-set-rules tromp-taylor 24 | set_position w d7 b e7 b f7 w b6 w d6 w e6 b f6 b b5 w c5 w d5 b e5 w b4 w c4 b e4 b b3 w c3 b d3 b e3 w f3 b g3 w a2 w b2 b c2 b d2 b f2 b b1 25 | komi 5 26 | genmove_debug b 27 | genmove_debug w 28 | genmove_debug b 29 | genmove_debug w 30 | play b pass 31 | genmove_debug w 32 | undo 33 | play w pass 34 | showboard 35 | final_status_list alive 36 | final_status_list dead 37 | final_score 38 | genmove_debug b 39 | undo 40 | play b pass 41 | showboard 42 | final_status_list alive 43 | final_status_list dead 44 | final_score 45 | 46 | -------------------------------------------------------------------------------- /cpp/tests/gtp/handicap.txt: -------------------------------------------------------------------------------- 1 | fixed_handicap 7 2 | showboard 3 | genmove_debug w 4 | clear_board 5 | place_free_handicap 3 6 | showboard 7 | genmove_debug w 8 | play b A1 9 | genmove_debug w 10 | play b C1 11 | genmove_debug w 12 | play b B1 13 | genmove_debug w 14 | clear_board 15 | set_free_handicap c4 q16 d17 16 | showboard 17 | play w Q4 18 | genmove_debug b 19 | boardsize 13 20 | fixed_handicap 3 21 | showboard 22 | play w K4 23 | genmove_debug b 24 | genmove_debug w 25 | genmove_debug b 26 | clear_board 27 | boardsize 2 28 | set_free_handicap a1 b1 a2 29 | showboard 30 | clear_board 31 | set_free_handicap a1 b1 a2 b2 32 | showboard 33 | -------------------------------------------------------------------------------- /cpp/tests/gtp/misc.txt: -------------------------------------------------------------------------------- 1 | kata-list-params 2 | 3 | komi 50.5 4 | get_komi 5 | komi -23 6 | get_komi 7 | 8 | version 9 | kata-get-models 10 | kata-set-param humanSLProfile rank_10k 11 | kata-get-param allowResignation 12 | kata-get-param ponderingEnabled 13 | kata-get-param delayMoveMax 14 | kata-get-param maxVisits 15 | kata-set-param delayMoveMax 1234 16 | kata-set-param allowResignation false 17 | kata-get-param allowResignation 18 | kata-get-param ponderingEnabled 19 | kata-get-param delayMoveMax 20 | kata-get-param maxVisits 21 | kata-set-param delayMoveMax 12345 22 | kata-set-param maxVisits 4321 23 | kata-get-param allowResignation 24 | kata-get-param ponderingEnabled 25 | kata-get-param delayMoveMax 26 | kata-get-param maxVisits 27 | 28 | 29 | -------------------------------------------------------------------------------- /cpp/tests/gtp/printsgf.txt: -------------------------------------------------------------------------------- 1 | printsgf 2 | boardsize 9 3 | kata-set-rules japanese 4 | play b c3 5 | play w c6 6 | play b c9 7 | printsgf - 8 | clear_board 9 | rectangular_boardsize 9:13 10 | kata-set-rules chinese 11 | place_free_handicap 3 12 | genmove w 13 | printsgf 14 | kata-set-rule tax seki 15 | printsgf 16 | -------------------------------------------------------------------------------- /cpp/tests/gtp/printsgffinalscore.txt: -------------------------------------------------------------------------------- 1 | printsgf 2 | boardsize 7 3 | komi 0 4 | play b d7 5 | play w e7 6 | play b d6 7 | play w e6 8 | play b d5 9 | play w e5 10 | play b d4 11 | play w e4 12 | play b d3 13 | play w e3 14 | play b d2 15 | play w e2 16 | play b d1 17 | play w e1 18 | play b b3 19 | play w f4 20 | play b f5 21 | play w f6 22 | play b b5 23 | play w pass 24 | kata-set-rules tromp-taylor 25 | printsgf - 26 | kata-set-rules chinese 27 | printsgf - 28 | play b pass 29 | kata-set-rules tromp-taylor 30 | printsgf - 31 | kata-set-rules chinese 32 | printsgf - 33 | -------------------------------------------------------------------------------- /cpp/tests/gtp/rawnn.txt: -------------------------------------------------------------------------------- 1 | boardsize 9 2 | kata-set-rules chinese 3 | play b c3 4 | play w c6 5 | kata-raw-nn 1 6 | kata-raw-nn 4 7 | kata-raw-nn 6 8 | rectangular_boardsize 7:10 9 | kata-set-rules new-zealand 10 | play b c3 11 | play w c7 12 | play b f7 13 | kata-raw-nn all 14 | -------------------------------------------------------------------------------- /cpp/tests/gtp/rules.txt: -------------------------------------------------------------------------------- 1 | kata-get-rules 2 | kata-set-rules japanese 3 | kata-get-rules 4 | kata-set-rules chinese 5 | kata-get-rules 6 | kgs-rules chinese 7 | kata-get-rules 8 | kgs-rules new_zealand 9 | kata-get-rules 10 | -------------------------------------------------------------------------------- /cpp/tests/gtp/set_boardsize_twice.txt: -------------------------------------------------------------------------------- 1 | boardsize 15 2 | showboard 3 | play b c3 4 | play w d4 5 | showboard 6 | boardsize 15 7 | showboard 8 | boardsize 19 9 | showboard 10 | play b a1 11 | play w a2 12 | showboard 13 | boardsize 19 14 | showboard 15 | -------------------------------------------------------------------------------- /cpp/tests/gtp/set_position.txt: -------------------------------------------------------------------------------- 1 | showboard 2 | set_position b c3 W q16 black q17 BLACK k10 black c5 WHITE q13 3 | showboard 4 | set_position 5 | showboard 6 | boardsize 13 7 | showboard 8 | set_position w d3 w d10 w j10 9 | showboard 10 | set_position b d3 b d10 b j10 11 | showboard 12 | set_position b d3 b d10 b j10 b 13 | showboard 14 | set_position w d3 w d10 w j10 15 | showboard 16 | set_position b d3 b d3 17 | showboard 18 | set_position b d3 w d3 19 | showboard 20 | set_position b d4 w d3 w e4 w d5 21 | showboard 22 | set_position b d4 w d3 w e4 w d5 w c4 23 | showboard 24 | set_position b pass 25 | showboard 26 | boardsize 3 27 | showboard 28 | set_position b a1 b a2 b a3 b b1 b b2 b b3 b c1 b c2 29 | showboard 30 | set_position b a1 b a2 b a3 b b1 b b2 b b3 b c1 b c2 b c3 31 | showboard 32 | -------------------------------------------------------------------------------- /cpp/tests/gtp/setparams.txt: -------------------------------------------------------------------------------- 1 | genmove b 2 | clear_cache 3 | genmove w 4 | undo 5 | kata-set-param analysisWideRootNoise 1 6 | kata-get-param analysisWideRootNoise 7 | kata-get-param wideRootNoise 8 | genmove w 9 | undo 10 | kata-set-params {"wideRootNoise":0.6, "analysisWideRootNoise" :0.9 } 11 | kata-get-param analysisWideRootNoise 12 | kata-get-param wideRootNoise 13 | genmove w 14 | undo 15 | kata-set-param wideRootNoise 0 16 | kata-set-param playoutDoublingAdvantage 1 17 | kata-get-params 18 | genmove w 19 | undo 20 | kata-set-param dynamicPlayoutDoublingAdvantageCapPerOppLead 0.045 21 | kata-get-params 22 | genmove w 23 | undo 24 | kata-search_debug w 25 | kata-set-param cpuctExploration 1.0 26 | debug_moves 27 | kata-set-param cpuctExploration 3.0 28 | debug_moves 29 | kata-get-param cpuctExploration 30 | genmove_debug w 31 | kata-get-param numSearchThreads 32 | kata-set-param numSearchThreads 2 33 | kata-get-param numSearchThreads 34 | -------------------------------------------------------------------------------- /cpp/tests/models/README.txt: -------------------------------------------------------------------------------- 1 | These are small and weak neural net models for testing only. 2 | 3 | See: 4 | https://github.com/lightvector/KataGo/releases 5 | or 6 | https://d3dndmfyhecmj0.cloudfront.net/ 7 | 8 | for the actual latest neural nets. 9 | 10 | -------------------------------------------------------------------------------- /cpp/tests/models/findLatestModelTest1/empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/findLatestModelTest1/empty.txt -------------------------------------------------------------------------------- /cpp/tests/models/findLatestModelTest2/abc.bin.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/findLatestModelTest2/abc.bin.gz -------------------------------------------------------------------------------- /cpp/tests/models/findLatestModelTest3/def/model.bin.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/findLatestModelTest3/def/model.bin.gz -------------------------------------------------------------------------------- /cpp/tests/models/findLatestModelTest4/abc.bin.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/findLatestModelTest4/abc.bin.gz -------------------------------------------------------------------------------- /cpp/tests/models/findLatestModelTest4/def/ghi.bin.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/findLatestModelTest4/def/ghi.bin.gz -------------------------------------------------------------------------------- /cpp/tests/models/findLatestModelTest4/def/model.bin.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/findLatestModelTest4/def/model.bin.gz -------------------------------------------------------------------------------- /cpp/tests/models/g103-b6c96-s103408384-d26419149-info.txt: -------------------------------------------------------------------------------- 1 | Strongest 6 block neural net from g103 run for second public release. 2 | Probably top amateur dan level, maybe somewhat pro level on good enough hardware. 3 | 4 | {"support_japanese_rules": false, "trunk_num_channels": 96, "mid_num_channels": 96, "regular_num_channels": 64, "dilated_num_channels": 32, "gpool_num_channels": 32, "block_kind": [["rconv1", "regular"], ["rconv2", "regular"], ["rconv3", "gpool"], ["rconv4", "regular"], ["rconv5", "gpool"], ["rconv6", "regular"]], "p1_num_channels": 32, "g1_num_channels": 32, "v1_num_channels": 32, "sbv2_num_channels": 48, "bbv2_num_channels": 32, "v2_size": 48} 5 | -------------------------------------------------------------------------------- /cpp/tests/models/g103-b6c96-s103408384-d26419149.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/g103-b6c96-s103408384-d26419149.txt.gz -------------------------------------------------------------------------------- /cpp/tests/models/g170-b6c96-s175395328-d26788732-info.txt: -------------------------------------------------------------------------------- 1 | Final 6-block selfplay net from official Jan 2020 run. 2 | 3 | {"version": 8, "support_japanese_rules": true, "use_fixup": true, "trunk_num_channels": 96, "mid_num_channels": 96, "regular_num_channels": 64, "dilated_num_channels": 32, "gpool_num_channels": 32, "block_kind": [["rconv1", "regular"], ["rconv2", "regular"], ["rconv3", "gpool"], ["rconv4", "regular"], ["rconv5", "gpool"], ["rconv6", "regular"]], "p1_num_channels": 32, "g1_num_channels": 32, "v1_num_channels": 32, "sbv2_num_channels": 48, "v2_size": 64} 4 | -------------------------------------------------------------------------------- /cpp/tests/models/g170-b6c96-s175395328-d26788732.bin.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/g170-b6c96-s175395328-d26788732.bin.gz -------------------------------------------------------------------------------- /cpp/tests/models/g170-b6c96-s175395328-d26788732.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/g170-b6c96-s175395328-d26788732.txt.gz -------------------------------------------------------------------------------- /cpp/tests/models/g170e-b10c128-s1141046784-d204142634.bin.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/g170e-b10c128-s1141046784-d204142634.bin.gz -------------------------------------------------------------------------------- /cpp/tests/models/grun2-b6c96-s128700160-d49811312-info.txt: -------------------------------------------------------------------------------- 1 | From gcloud test training run 2 2 | 3 | {"trunk_num_channels": 96, "mid_num_channels": 96, "regular_num_channels": 64, "dilated_num_channels": 32, "gpool_num_channels": 32, "block_kind": [["rconv1", "regular"], ["rconv2", "regular"], ["rconv3", "gpool"], ["rconv4", "regular"], ["rconv5", "gpool"], ["rconv6", "regular"]], "p1_num_channels": 48, "g1_num_channels": 32, "v1_num_channels": 32, "sbv2_num_channels": 32, "bbv2_num_channels": 16, "v2_size": 32} 4 | 5 | -------------------------------------------------------------------------------- /cpp/tests/models/grun2-b6c96-s128700160-d49811312.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/grun2-b6c96-s128700160-d49811312.txt.gz -------------------------------------------------------------------------------- /cpp/tests/models/grun50-b6c96-s156348160-d118286860.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/grun50-b6c96-s156348160-d118286860.txt.gz -------------------------------------------------------------------------------- /cpp/tests/models/run4-s67105280-d24430742-b6c96-info.txt: -------------------------------------------------------------------------------- 1 | From micro test training run 4 2 | 3 | {"trunk_num_channels": 96, "mid_num_channels": 96, 4 | "regular_num_channels": 64, "dilated_num_channels": 32, 5 | "gpool_num_channels": 32, "block_kind": [["rconv1", "regular"], 6 | ["rconv2", "regular"], ["rconv3", "gpool"], ["rconv4", "regular"], 7 | ["rconv5", "gpool"], ["rconv6", "regular"]], "p1_num_channels": 48, 8 | "g1_num_channels": 32, "v1_num_channels": 32, "sbv2_num_channels": 32, 9 | "bbv2_num_channels": 16, "v2_size": 32} 10 | 11 | Roughly around 93k games into training. 12 | -------------------------------------------------------------------------------- /cpp/tests/models/run4-s67105280-d24430742-b6c96.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/cpp/tests/models/run4-s67105280-d24430742-b6c96.txt.gz -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/00/1914085000B63B9CDFA79D5E46E7F4F0AF083A16D86C2847A66D1D964D580B72.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/01/04DD95D301B0A2F4703B3208D576D815A0970CF1F769483FC5B33E4892A6A2C5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/04/582CE3F7042C68742DB4E536AE45BCFCF181B63082EDE6F387F79462D39983EA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/0A/0ECCECCB0A81BDB622B142764A9BB9EAB5995B73517F04D18DA0EB8F444FF807.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/18/1348BE2E185C3B383D98A2EB8CA38DEDC314696B68D5E4B733AA3BDFA0D008C2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/1C/0DD58B411C0829D8036A6E048FE73BB7A9CC0CF82C071821A9F7D88E9D459E20.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/1E/085669C61E2E1EAB4C5E86C130D6133C3DEFD1FBE8D842ACBC986A7AD59AD46C.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/25/23DD4920257320C06C3528EA2AD5206F75797D69047778590406B34267CDF23B.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/2C/3197D4932C12245EF43A29B4C7E0CDE724F602561A91ECE3569DC2C9C049CC05.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/31/F17EA86A31F03431F3D61EC3DFDB2CEDB673834A312D577285070E44F6822F41.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/3E/13CAEB503EAB113D7668ED076EABD5051936FB563F5826FD1C4C0A591A6E227D.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/3E/746A7A933E8FC1C2DF9BBA0BD5B396F186957B85744D591D11529C005401C439.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/48/00E5B7E44801D1632C1EE7142B798FC95FEC1A7A51D464655F956C4D42133016.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/4C/0AE3074E4C25378FC03FA107094102F35E6053FC75D50829A8E20124F872D010.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/56/417A1A4156ACBF58E79325D34F2A235DE4B1D62137F92AB42E507F3041D986CC.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/59/3F8C5EF0590F9F0DFD33BE889E8E00350B835EE9977532755C8971DE43A18056.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/5A/68967FA95AC0019E9A08FF65DEA2C09E262864AB98C28B8614E3DC6ADF8F2299.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/5B/37E7FD895BD61EAECAF38886988533E6EDEAD3DB6F26475ABC3A3C50D5934001.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/62/07E60C476267477BF941FA45B5C35F893EB7E9BB8826468EC0D720BF3117AF7F.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/66/2EBF4C1766C5B26BDA7700D59457DC332C4B36A42DBC317B3DC59E08A7CFAA78.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/78/016DAE14782CB4D07B917F5138C3E225A230DD59794695B4A27F31C8EA4DE8E2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/80/04ADF43B80AD7E5EC4395E736811747C73D8C9AD2E6C8A9264ED6682A14BB235.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/84/0CE5340384809D7F51CCF807E4D31450A6A5F134456A479F60F39D8787659861.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/87/115D5BAD87D16F6FC11E5253300E850840FD2E71C1081F012C2A919E4866F25E.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/8A/04AC73B38A30BAD5FB7CA1872587A382AE175AEBC48BFB772285327758EF0249.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/8A/0A281BE28AACCA5150D80C1D13ECAD7EEB550661BB5E623BAE9325FDC7B97ED8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/8A/9A39C91C8A097F7C819FEBDA12CCC51631ABE19FDAAA2F795C0C02D132B84158.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/8D/12F3FFAA8D2F04F609AEB7CAFE2D416FAB96F8B8F5E86F36735B1C9120905272.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/9B/53994BA69B05FE49B9D58DB51153B0407BE897F2C4131135C5BC7AAC90C2C123.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/A0/23A3B394A056CC98CAA720A4EFE26605E43170679500026C119E60ACC0A5E25D.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/A0/4CFF8E46A0AA542F60F6E2D484F45C06C8E97D89D0D0D9DD7C0A827994DDBBA2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/A2/5C733B2FA2111CE1463CDD3DAD7A0F58F814C7E969EE75569D7A13419AD0A5CB.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/A6/2D434E13A618B96B2D08480991EA65024841C03D916CD99216082331279038A1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/A8/02013E8BA826FB1EA4448D3CC0E5B3234B05DB053AD458076C62CEB810E47B40.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/AF/02A8F886AF9908D438B02A0E06443CBB0631DB3E8D548DEBA51B3BF5FADEB88E.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/B1/03CFDD9FB14826863905C52545E787859491A423FB884925530FACC436EF4883.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/B6/04BBDFC9B6B45290032FC42860DB2A04A03622A9FFC4E364BFE570886B3C26E0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/B7/13FB135DB7FA4709C151FB1AB0738CDD39D6CB69AB9315C9C00D781843F72EEE.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/B7/19AF84A1B7F809E830B722E09E2D8C4FEED975C01BFB235DC77BD1B35CAEF8F8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/B7/3FBBD2A1B787C6748A7D26CB2C5AC8D51FD958ACA17BC5516E4101C8F6F32C59.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/C4/09BEE6F7C4436FE4AE6EA485F27FC0A1D51762136CFABA26A28939EC9A9D82B7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/C4/3C66CFA1C4081459EF4C5EDBDCD6FAA44703DF4D2F0AC62BC4E69129598CB631.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/C5/34C4CA6CC54FF9201DBB9B17D93689B9E1AA73E8FBC7AFA1060853AAC6D2B01A.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/CC/11CAE46CCC6762E19EE8E65A4096F2649B27B6F84884673EF9013163E9157498.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/CE/014D3080CE05146F91F3CB7E24E6687BDE992E25A651B33D548054FEFAC0D595.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/D1/0B160E94D1AD7717BF170224C3237824AAD5B2F70CD26316F001415A56BFE64E.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/D4/08E06FB3D454DCA4A4C9295593DDA5C80C1BCE6F62A7C0515F6E018951681C8B.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/D5/0EBC1635D5BBD265ABAA804F3B8355B65206EAD290AA7A4D5465D426CF538C60.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/D9/06D3670CD95F1479B97C128D7E977104CB3D703623FDB0F57DD910D91FC60217.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/E0/00AA5E7BE054932A4FEDC0E2A8630E43657D6E1E9F444F7774D49A6CA90EC51D.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/E4/1645D124E498577A593F5E5F66225AF6C76F731B015F1128FDDD5DC92AB88F4D.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/E6/5DE5DBB5E626B16C8557A629ECD96A9F20591BD96978322C79B8A3ABAE93DACD.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/F8/2CBEAE01F8379B94767891CB8FAF9E4E8A83A111CB910265346815B4DFD4ECC3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/F9/1EEE9328F9E906CAB35BBB7225762B54D3BCA5E8CC173C5F1C29CA0E8F647C71.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/bookhtml/FD/215D9460FD1631208537CEF24D5BAF24EC7B8AA7FBCA734CA02F2F47C6E4D0ED.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /cpp/tests/results/checkbook.txt: -------------------------------------------------------------------------------- 1 | : Loaded preexisting book with 1890 nodes from tests/data/test.katabook 2 | : Book version = 2 3 | : Checking book... 4 | : DONE 5 | -------------------------------------------------------------------------------- /cpp/tests/results/cmd/analysis_help.stdout: -------------------------------------------------------------------------------- 1 | 2 | DESCRIPTION: 3 | 4 | Run KataGo parallel JSON-based analysis engine. 5 | 6 | USAGE: 7 | 8 | analysis -config ... [-model ] [-human-model ] 9 | [...other flags...] 10 | 11 | 12 | Where: 13 | 14 | -config (accepted multiple times) 15 | (required) Config file(s) to use, can be one or multiple files (see 16 | analysis_example.cfg or configs/analysis_example.cfg). 17 | 18 | -model 19 | Neural net model file. Defaults to: (dir containing katago.exe, or 20 | else ~/.katago)/default_model.bin.gz 21 | 22 | -human-model 23 | Human SL neural net model file 24 | 25 | -override-config (accepted multiple times) 26 | Override config parameters. Format: "key=value, key=value,..." 27 | 28 | -analysis-threads 29 | Analyze up to this many positions in parallel. Equivalent to 30 | numAnalysisThreads in the config. 31 | 32 | -quit-without-waiting 33 | When stdin is closed, quit quickly without waiting for queued tasks 34 | 35 | --, -ignore_rest 36 | Ignores the rest of the labeled arguments following this flag. 37 | 38 | -version 39 | Displays version information and exits. 40 | 41 | -h, -help 42 | Displays usage information and exits. 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /cpp/tests/results/cmd/contribute_help.stdout: -------------------------------------------------------------------------------- 1 | 2 | DESCRIPTION: 3 | 4 | Run KataGo to generate training data for distributed training 5 | 6 | USAGE: 7 | 8 | contribute [-base-dir ] [-delete-unused-models-after ] 9 | [-config ] [-override-config ] 10 | [-cacerts ] 11 | 12 | 13 | Where: 14 | 15 | -base-dir 16 | Directory to download models, write game results, etc. (default 17 | ./katago_contribute) 18 | 19 | -delete-unused-models-after 20 | After a model is unused for this many days, delete it from disk 21 | (default 30) 22 | 23 | -config 24 | Config file to use for server connection and/or GPU settings 25 | 26 | -override-config 27 | Override config parameters. Format: "key=value, key=value,..." 28 | 29 | -cacerts 30 | CA certificates file for SSL (cacerts.pem, ca-bundle.crt) 31 | 32 | --, -ignore_rest 33 | Ignores the rest of the labeled arguments following this flag. 34 | 35 | -version 36 | Displays version information and exits. 37 | 38 | -h, -help 39 | Displays usage information and exits. 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /cpp/tests/results/cmd/gatekeeper_help.stdout: -------------------------------------------------------------------------------- 1 | 2 | DESCRIPTION: 3 | 4 | Test neural nets to see if they should be accepted for self-play 5 | training data generation. 6 | 7 | USAGE: 8 | 9 | gatekeeper -config ... [-override-config ] ... 10 | -test-models-dir -sgf-output-dir 11 | -accepted-models-dir -rejected-models-dir 12 | [-selfplay-dir ] [-required-candidate-win-prop ] 13 | [...other flags...] 14 | 15 | 16 | Where: 17 | 18 | -config (accepted multiple times) 19 | (required) Config file(s) to use, can be one or multiple files. 20 | 21 | -override-config (accepted multiple times) 22 | Override config parameters. Format: "key=value, key=value,..." 23 | 24 | -test-models-dir 25 | (required) Dir to poll and load models from 26 | 27 | -sgf-output-dir 28 | (required) Dir to output sgf files 29 | 30 | -accepted-models-dir 31 | (required) Dir to write good models to 32 | 33 | -rejected-models-dir 34 | (required) Dir to write bad models to 35 | 36 | -selfplay-dir 37 | Dir where selfplay data will be produced if a model passes 38 | 39 | -required-candidate-win-prop 40 | Required win prop to accept 41 | 42 | -no-autoreject-old-models 43 | Test older models than the latest accepted model 44 | 45 | -quit-if-no-nets-to-test 46 | Terminate instead of waiting for a new net to test 47 | 48 | --, -ignore_rest 49 | Ignores the rest of the labeled arguments following this flag. 50 | 51 | -version 52 | Displays version information and exits. 53 | 54 | -h, -help 55 | Displays usage information and exits. 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /cpp/tests/results/cmd/genconfig_help.stdout: -------------------------------------------------------------------------------- 1 | 2 | DESCRIPTION: 3 | 4 | Automatically generate and tune a new GTP config. 5 | 6 | USAGE: 7 | 8 | genconfig [-model ] [-output ] 9 | 10 | 11 | Where: 12 | 13 | -model 14 | Neural net model file. Defaults to: (dir containing katago.exe, or 15 | else ~/.katago)/default_model.bin.gz 16 | 17 | -output 18 | Path to write new config (default gtp.cfg) 19 | 20 | --, -ignore_rest 21 | Ignores the rest of the labeled arguments following this flag. 22 | 23 | -version 24 | Displays version information and exits. 25 | 26 | -h, -help 27 | Displays usage information and exits. 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /cpp/tests/results/cmd/gtp_help.stdout: -------------------------------------------------------------------------------- 1 | 2 | DESCRIPTION: 3 | 4 | Run KataGo main GTP engine for playing games or casual analysis. 5 | 6 | USAGE: 7 | 8 | gtp [-config ] ... [-model ] [-human-model ] 9 | [...other flags...] 10 | 11 | 12 | Where: 13 | 14 | -config (accepted multiple times) 15 | Config file(s) to use, can be one or multiple files (see 16 | gtp_example.cfg or configs/gtp_example.cfg). Defaults to: (dir 17 | containing katago.exe, or else ~/.katago)/default_gtp.cfg 18 | 19 | -model 20 | Neural net model file. Defaults to: (dir containing katago.exe, or 21 | else ~/.katago)/default_model.bin.gz 22 | 23 | -human-model 24 | Human SL neural net model file 25 | 26 | -override-config (accepted multiple times) 27 | Override config parameters. Format: "key=value, key=value,..." 28 | 29 | -override-version 30 | Force KataGo to say a certain value in response to gtp version command 31 | 32 | --, -ignore_rest 33 | Ignores the rest of the labeled arguments following this flag. 34 | 35 | -version 36 | Displays version information and exits. 37 | 38 | -h, -help 39 | Displays usage information and exits. 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /cpp/tests/results/cmd/match_help.stdout: -------------------------------------------------------------------------------- 1 | 2 | DESCRIPTION: 3 | 4 | Play different nets against each other with different search settings in 5 | a match or tournament. 6 | 7 | USAGE: 8 | 9 | match -config ... [-log-file ] [-sgf-output-dir ] 10 | [...other flags...] 11 | 12 | 13 | Where: 14 | 15 | -config (accepted multiple times) 16 | (required) Config file(s) to use, can be one or multiple files (see 17 | match_example.cfg or configs/match_example.cfg). 18 | 19 | -log-file 20 | Log file to output to 21 | 22 | -sgf-output-dir 23 | Dir to output sgf files 24 | 25 | -override-config (accepted multiple times) 26 | Override config parameters. Format: "key=value, key=value,..." 27 | 28 | --, -ignore_rest 29 | Ignores the rest of the labeled arguments following this flag. 30 | 31 | -version 32 | Displays version information and exits. 33 | 34 | -h, -help 35 | Displays usage information and exits. 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /cpp/tests/results/cmd/selfplay_help.stdout: -------------------------------------------------------------------------------- 1 | 2 | DESCRIPTION: 3 | 4 | Generate training data via self play. 5 | 6 | USAGE: 7 | 8 | selfplay -config ... [-override-config ] ... 9 | -models-dir -output-dir [-max-games-total 10 | ] 11 | 12 | 13 | Where: 14 | 15 | -config (accepted multiple times) 16 | (required) Config file(s) to use, can be one or multiple files. 17 | 18 | -override-config (accepted multiple times) 19 | Override config parameters. Format: "key=value, key=value,..." 20 | 21 | -models-dir 22 | (required) Dir to poll and load models from 23 | 24 | -output-dir 25 | (required) Dir to output files 26 | 27 | -max-games-total 28 | Terminate after this many games 29 | 30 | --, -ignore_rest 31 | Ignores the rest of the labeled arguments following this flag. 32 | 33 | -version 34 | Displays version information and exits. 35 | 36 | -h, -help 37 | Displays usage information and exits. 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/avoidcorners.stdout: -------------------------------------------------------------------------------- 1 | = R15 2 | 3 | = R16 4 | 5 | = Q15 6 | 7 | = Q16 8 | 9 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/basic.txt.stdout: -------------------------------------------------------------------------------- 1 | = Q3 2 | 3 | = Q17 4 | 5 | = 6 | 7 | = D3 8 | 9 | = Q17 10 | 11 | = 12 | 13 | = E6 14 | 15 | = MoveNum: 1 HASH: F6947E54F53D680912E6585605F8EFAC 16 | A B C D E F G H J 17 | 9 . . . . . . . . . 18 | 8 . . . . . . . . . 19 | 7 . . . . . . . . . 20 | 6 . . . . X1. . . . 21 | 5 . . . . . . . . . 22 | 4 . . . . . . . . . 23 | 3 . . . . . . . . . 24 | 2 . . . . . . . . . 25 | 1 . . . . . . . . . 26 | Next player: White 27 | Rules: {"friendlyPassOk":false,"hasButton":false,"ko":"POSITIONAL","komi":7.5,"scoring":"AREA","suicide":true,"tax":"NONE","whiteHandicapBonus":"0"} 28 | B stones captured: 0 29 | W stones captured: 0 30 | 31 | = E4 32 | 33 | = E4 34 | 35 | = E4 36 | 37 | = D4 38 | 39 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/defaultkomibutton.stdout: -------------------------------------------------------------------------------- 1 | = Q3 2 | 3 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/defaultkomiterr.stdout: -------------------------------------------------------------------------------- 1 | = Q3 2 | 3 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/defaultkomitt.stdout: -------------------------------------------------------------------------------- 1 | = R4 2 | 3 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/forcedkomi.stdout: -------------------------------------------------------------------------------- 1 | = Q17 2 | 3 | = 4 | 5 | = Q3 6 | 7 | = 8 | 9 | = 10 | 11 | = C16 12 | 13 | = 14 | 15 | = Q3 16 | 17 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/genmoveanalyze.stderr: -------------------------------------------------------------------------------- 1 | KataGo v1.16.0 2 | Using TrompTaylor rules initially, unless GTP/GUI overrides this 3 | Initializing board with boardXSize 9 boardYSize 9 4 | Loaded config configs/gtp_example.cfg and/or command-line and query overrides 5 | Loaded model models/b18c384nbt-uec.bin.gz 6 | Model name: b18c384nbt-uec-20221121b 7 | GTP ready, beginning main protocol loop 8 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/humansl.stderr: -------------------------------------------------------------------------------- 1 | KataGo v1.16.0 2 | Using Japanese rules initially, unless GTP/GUI overrides this 3 | Initializing board with boardXSize 19 boardYSize 19 4 | Loaded config configs/gtp_human5k_example.cfg and/or command-line and query overrides 5 | Loaded model models/b18c384nbt-uec.bin.gz 6 | Loaded human SL model models/b18c384nbt-humanv0.bin.gz 7 | Model name: b18c384nbt-uec-20221121b 8 | Human SL model name: b18c384nbt-humanv0 9 | GTP ready, beginning main protocol loop 10 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/humansl2.stderr: -------------------------------------------------------------------------------- 1 | KataGo v1.16.0 2 | Using Japanese rules initially, unless GTP/GUI overrides this 3 | Initializing board with boardXSize 19 boardYSize 19 4 | Loaded config configs/gtp_human5k_example.cfg and/or command-line and query overrides 5 | Loaded model models/b18c384nbt-uec.bin.gz 6 | Loaded human SL model models/b18c384nbt-humanv0.bin.gz 7 | Model name: b18c384nbt-uec-20221121b 8 | Human SL model name: b18c384nbt-humanv0 9 | GTP ready, beginning main protocol loop 10 | Sgf has no rules, using default rules with SGF-specified komi: koSIMPLEscoreTERRITORYtaxSEKIsui0komi7.5 11 | Changing komi to 7.5 12 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/humansl2.stdout: -------------------------------------------------------------------------------- 1 | = 2 | 3 | = 4 | info move K16 visits 4 edgeVisits 4 utility 0.248006 winrate 0.619908 scoreMean 1.40093 scoreStdev 16.5324 scoreLead 1.40093 scoreSelfplay 1.86372 prior 0.253913 lcb 0.424479 utilityLcb -0.260107 weight 4 order 0 pv K16 F9 F7 info move J15 visits 5 edgeVisits 5 utility 0.258182 winrate 0.624476 scoreMean 1.51134 scoreStdev 16.9377 scoreLead 1.51134 scoreSelfplay 2.11661 prior 0.194069 lcb 0.459144 utilityLcb -0.171682 weight 5 order 1 pv J15 F9 F7 info move Q4 visits 11 edgeVisits 0 utility -0.0977103 winrate 0.453559 scoreMean -0.671423 scoreStdev 17.2528 scoreLead -0.671423 scoreSelfplay -1.12524 prior 0.0207002 lcb -4.54644 utilityLcb -13 weight 11 order 2 pv Q4 J16 H17 R6 info move R7 visits 4 edgeVisits 0 utility 0.0141998 winrate 0.507476 scoreMean -0.0134826 scoreStdev 16.4172 scoreLead -0.0134826 scoreSelfplay -0.185125 prior 0.0893424 lcb -4.49252 utilityLcb -13 weight 4 order 3 pv R7 R8 Q7 info move S3 visits 2 edgeVisits 0 utility -0.146226 winrate 0.430526 scoreMean -1.18367 scoreStdev 16.9412 scoreLead -1.18367 scoreSelfplay -1.70304 prior 0.0087584 lcb -4.56947 utilityLcb -13 weight 2 order 4 pv S3 F9 info move S4 visits 1 edgeVisits 0 utility -0.772964 winrate 0.130399 scoreMean -7.63778 scoreStdev 18.7116 scoreLead -7.63778 scoreSelfplay -8.00319 prior 1.67207e-05 lcb -4.8696 utilityLcb -13 weight 1 order 5 pv S4 info move R6 visits 1 edgeVisits 0 utility -0.289968 winrate 0.360241 scoreMean -1.6823 scoreStdev 17.8696 scoreLead -1.6823 scoreSelfplay -2.43287 prior 0.00170988 lcb -4.63976 utilityLcb -13 weight 1 order 6 pv R6 info move R8 visits 1 edgeVisits 0 utility -0.209823 winrate 0.398639 scoreMean -1.06024 scoreStdev 17.584 scoreLead -1.06024 scoreSelfplay -1.64668 prior 0.0620775 lcb -4.60136 utilityLcb -13 weight 1 order 7 pv R8 5 | play Q4 6 | 7 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/misc.txt.stderr: -------------------------------------------------------------------------------- 1 | KataGo v1.16.0 2 | Using TrompTaylor rules initially, unless GTP/GUI overrides this 3 | Initializing board with boardXSize 19 boardYSize 19 4 | Loaded config configs/gtp_example.cfg and/or command-line and query overrides 5 | Loaded model tests/models/g170-b6c96-s175395328-d26788732.bin.gz 6 | Model name: g170-b6c96-s175395328-d26788732 7 | GTP ready, beginning main protocol loop 8 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/nologconfig.stdout: -------------------------------------------------------------------------------- 1 | = R16 2 | 3 | = Q3 4 | 5 | = D3 6 | 7 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/printsgf.txt.stderr: -------------------------------------------------------------------------------- 1 | KataGo v1.16.0 2 | Using TrompTaylor rules initially, unless GTP/GUI overrides this 3 | Initializing board with boardXSize 19 boardYSize 19 4 | Loaded config configs/gtp_example.cfg and/or command-line and query overrides 5 | Loaded model tests/models/g170-b6c96-s175395328-d26788732.bin.gz 6 | Model name: g170-b6c96-s175395328-d26788732 7 | GTP ready, beginning main protocol loop 8 | Initializing board with boardXSize 9 boardYSize 9 9 | Changed rules to Japanese 10 | Initializing board with boardXSize 9 boardYSize 13 11 | Changed rules to Chinese 12 | Changed rules to koSIMPLEscoreAREAtaxSEKIsui0whbNfpok1 13 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/printsgf.txt.stdout: -------------------------------------------------------------------------------- 1 | = (;FF[4]GM[1]SZ[19]PB[]PW[]HA[0]KM[7.5]RU[TrompTaylor]) 2 | 3 | = 4 | 5 | = 6 | 7 | = 8 | 9 | = 10 | 11 | = 12 | 13 | = (;FF[4]GM[1]SZ[9]PB[]PW[]HA[0]KM[7.5]RU[Japanese];B[cg];W[cd];B[ca]) 14 | 15 | = 16 | 17 | = 18 | 19 | = 20 | 21 | = C10 E10 D4 22 | 23 | = F4 24 | 25 | = (;FF[4]GM[1]SZ[9:13]PB[]PW[]HA[3]KM[7.5]RU[Chinese]AB[cd][ed][dj];W[fj]) 26 | 27 | = 28 | 29 | = (;FF[4]GM[1]SZ[9:13]PB[]PW[]HA[3]KM[7.5]RU[koSIMPLEscoreAREAtaxSEKIsui0whbNfpok1]AB[cd][ed][dj];W[fj]) 30 | 31 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/printsgffinalscore.txt.stderr: -------------------------------------------------------------------------------- 1 | KataGo v1.16.0 2 | Using TrompTaylor rules initially, unless GTP/GUI overrides this 3 | Initializing board with boardXSize 19 boardYSize 19 4 | Loaded config configs/gtp_example.cfg and/or command-line and query overrides 5 | Loaded model tests/models/g170-b6c96-s175395328-d26788732.bin.gz 6 | Model name: g170-b6c96-s175395328-d26788732 7 | GTP ready, beginning main protocol loop 8 | Initializing board with boardXSize 7 boardYSize 7 9 | Changed rules to TrompTaylor 10 | Changed rules to Chinese 11 | Changed rules to TrompTaylor 12 | Changed rules to Chinese 13 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/printsgffinalscore.txt.stdout: -------------------------------------------------------------------------------- 1 | = (;FF[4]GM[1]SZ[19]PB[]PW[]HA[0]KM[7.5]RU[TrompTaylor]) 2 | 3 | = 4 | 5 | = 6 | 7 | = 8 | 9 | = 10 | 11 | = 12 | 13 | = 14 | 15 | = 16 | 17 | = 18 | 19 | = 20 | 21 | = 22 | 23 | = 24 | 25 | = 26 | 27 | = 28 | 29 | = 30 | 31 | = 32 | 33 | = 34 | 35 | = 36 | 37 | = 38 | 39 | = 40 | 41 | = 42 | 43 | = 44 | 45 | = 46 | 47 | = 48 | 49 | = (;FF[4]GM[1]SZ[7]PB[]PW[]HA[0]KM[0]RU[TrompTaylor];B[da];W[ea];B[db];W[eb];B[dc];W[ec];B[dd];W[ed];B[de];W[ee];B[df];W[ef];B[dg];W[eg];B[be];W[fd];B[fc];W[fb];B[bc];W[]) 50 | 51 | = 52 | 53 | = (;FF[4]GM[1]SZ[7]PB[]PW[]HA[0]KM[0]RU[Chinese];B[da];W[ea];B[db];W[eb];B[dc];W[ec];B[dd];W[ed];B[de];W[ee];B[df];W[ef];B[dg];W[eg];B[be];W[fd];B[fc];W[fb];B[bc];W[]) 54 | 55 | = 56 | 57 | = 58 | 59 | = (;FF[4]GM[1]SZ[7]PB[]PW[]HA[0]KM[0]RU[TrompTaylor]RE[B+20];B[da];W[ea];B[db];W[eb];B[dc];W[ec];B[dd];W[ed];B[de];W[ee];B[df];W[ef];B[dg];W[eg];B[be];W[fd];B[fc];W[fb];B[bc];W[];B[]C[result=B+20]) 60 | 61 | = 62 | 63 | = (;FF[4]GM[1]SZ[7]PB[]PW[]HA[0]KM[0]RU[Chinese]RE[B+7];B[da];W[ea];B[db];W[eb];B[dc];W[ec];B[dd];W[ed];B[de];W[ee];B[df];W[ef];B[dg];W[eg];B[be];W[fd];B[fc];W[fb];B[bc];W[];B[]C[result=B+7]) 64 | 65 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/rawnn.txt.stderr: -------------------------------------------------------------------------------- 1 | KataGo v1.16.0 2 | Using TrompTaylor rules initially, unless GTP/GUI overrides this 3 | Initializing board with boardXSize 19 boardYSize 19 4 | Loaded config configs/gtp_example.cfg and/or command-line and query overrides 5 | Loaded model tests/models/g170-b6c96-s175395328-d26788732.bin.gz 6 | Model name: g170-b6c96-s175395328-d26788732 7 | GTP ready, beginning main protocol loop 8 | Initializing board with boardXSize 9 boardYSize 9 9 | Changed rules to Chinese 10 | Initializing board with boardXSize 7 boardYSize 10 11 | Changed rules to NewZealand 12 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/rootsymprune.stdout: -------------------------------------------------------------------------------- 1 | = R16 2 | 3 | = Q3 4 | 5 | = D3 6 | 7 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/rules.txt.stderr: -------------------------------------------------------------------------------- 1 | KataGo v1.16.0 2 | Using TrompTaylor rules initially, unless GTP/GUI overrides this 3 | Initializing board with boardXSize 19 boardYSize 19 4 | Loaded config configs/gtp_example.cfg and/or command-line and query overrides 5 | Loaded model tests/models/g170-b6c96-s175395328-d26788732.bin.gz 6 | Model name: g170-b6c96-s175395328-d26788732 7 | GTP ready, beginning main protocol loop 8 | Changed rules to Japanese 9 | Changed rules to Chinese 10 | Changed rules to Chinese-OGS 11 | Changed rules to NewZealand 12 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/rules.txt.stdout: -------------------------------------------------------------------------------- 1 | = {"friendlyPassOk":false,"hasButton":false,"ko":"POSITIONAL","scoring":"AREA","suicide":true,"tax":"NONE","whiteHandicapBonus":"0"} 2 | 3 | = 4 | 5 | = {"friendlyPassOk":false,"hasButton":false,"ko":"SIMPLE","scoring":"TERRITORY","suicide":false,"tax":"SEKI","whiteHandicapBonus":"0"} 6 | 7 | = 8 | 9 | = {"friendlyPassOk":true,"hasButton":false,"ko":"SIMPLE","scoring":"AREA","suicide":false,"tax":"NONE","whiteHandicapBonus":"N"} 10 | 11 | = 12 | 13 | = {"friendlyPassOk":true,"hasButton":false,"ko":"POSITIONAL","scoring":"AREA","suicide":false,"tax":"NONE","whiteHandicapBonus":"N"} 14 | 15 | = 16 | 17 | = {"friendlyPassOk":true,"hasButton":false,"ko":"SITUATIONAL","scoring":"AREA","suicide":true,"tax":"NONE","whiteHandicapBonus":"0"} 18 | 19 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/searchcancellable.stderr: -------------------------------------------------------------------------------- 1 | KataGo v1.16.0 2 | Using TrompTaylor rules initially, unless GTP/GUI overrides this 3 | Initializing board with boardXSize 9 boardYSize 9 4 | Loaded config configs/gtp_example.cfg and/or command-line and query overrides 5 | Loaded model models/b18c384nbt-uec.bin.gz 6 | Model name: b18c384nbt-uec-20221121b 7 | GTP ready, beginning main protocol loop 8 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/set_boardsize_twice.txt.stderr: -------------------------------------------------------------------------------- 1 | KataGo v1.16.0 2 | Using TrompTaylor rules initially, unless GTP/GUI overrides this 3 | Initializing board with boardXSize 19 boardYSize 19 4 | Loaded config configs/gtp_example.cfg and/or command-line and query overrides 5 | Loaded model tests/models/g170-b6c96-s175395328-d26788732.bin.gz 6 | Model name: g170-b6c96-s175395328-d26788732 7 | GTP ready, beginning main protocol loop 8 | Initializing board with boardXSize 15 boardYSize 15 9 | Initializing board with boardXSize 19 boardYSize 19 10 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/set_position.txt.stderr: -------------------------------------------------------------------------------- 1 | KataGo v1.16.0 2 | Using TrompTaylor rules initially, unless GTP/GUI overrides this 3 | Initializing board with boardXSize 19 boardYSize 19 4 | Loaded config configs/gtp_example.cfg and/or command-line and query overrides 5 | Loaded model tests/models/g170-b6c96-s175395328-d26788732.bin.gz 6 | Model name: g170-b6c96-s175395328-d26788732 7 | GTP ready, beginning main protocol loop 8 | Initializing board with boardXSize 13 boardYSize 13 9 | Initializing board with boardXSize 3 boardYSize 3 10 | -------------------------------------------------------------------------------- /cpp/tests/results/gtp/time.txt.stderr: -------------------------------------------------------------------------------- 1 | KataGo v1.16.0 2 | Using TrompTaylor rules initially, unless GTP/GUI overrides this 3 | Initializing board with boardXSize 19 boardYSize 19 4 | Loaded config configs/gtp_example.cfg and/or command-line and query overrides 5 | Loaded model tests/models/g170-b6c96-s175395328-d26788732.bin.gz 6 | Model name: g170-b6c96-s175395328-d26788732 7 | GTP ready, beginning main protocol loop 8 | -------------------------------------------------------------------------------- /cpp/tests/results/runNNBatchingTest.txt: -------------------------------------------------------------------------------- 1 | Done 2 | -------------------------------------------------------------------------------- /cpp/tests/results/runNNBatchingTestFP16.txt: -------------------------------------------------------------------------------- 1 | Done 2 | -------------------------------------------------------------------------------- /cpp/tests/results/runNNBatchingTestNHWC.txt: -------------------------------------------------------------------------------- 1 | Done 2 | -------------------------------------------------------------------------------- /cpp/tests/results/runNNBatchingTestiNHWC.txt: -------------------------------------------------------------------------------- 1 | Done 2 | -------------------------------------------------------------------------------- /cpp/tests/results/runNNOnTinyBoardTest.txt: -------------------------------------------------------------------------------- 1 | : Initializing neural net buffer to be size 6 * 6 allowing smaller boards 2 | : Cuda backend thread 0: Found GPU NVIDIA RTX A5000 memory 25425608704 compute capability major 8 minor 6 3 | : Cuda backend thread 0: Model version 8 useFP16 = false useNHWC = false 4 | : Cuda backend thread 0: Model name: g170-b6c96-s175395328-d26788732 5 | HASH: 53602E4395E2B2B556BA45566880843F 6 | A B C D E 7 | 5 . . . . . 8 | 4 . . . X . 9 | 3 . . O . . 10 | 2 . X X O . 11 | 1 . . . . . 12 | 13 | 14 | 15 | Win 90.25c 16 | Loss 9.75c 17 | NoResult 0.00c 18 | ScoreMean 9.37 19 | ScoreMeanSq 242.8 20 | Lead 7.87 21 | VarTimeLeft -1.0 22 | STWinlossError -100.00c 23 | STScoreError -1.00 24 | OptimismUsed 0.00 25 | Policy 26 | Pass 0 27 | 0 0 0 0 0 28 | 0 3 150 - 0 29 | 0 237 - 607 0 30 | 0 - - - 0 31 | 0 0 0 1 0 32 | -21 -257 65 -419 121 33 | -129 -353 -489 -148 241 34 | -341 -367 -294 46 292 35 | -322 -457 -82 559 277 36 | -247 -394 -127 -132 91 37 | 38 | 39 | 40 | : GPU 0 finishing, processed 1 rows 1 batches 41 | -------------------------------------------------------------------------------- /cpp/tests/results/sampletest-basic/log.log: -------------------------------------------------------------------------------- 1 | : Command: samplesgfs 2 | : Command: -sgfdir 3 | : Command: tests/data/sampletest/ 4 | : Command: -outdir 5 | : Command: tests/results/sampletest-basic/ 6 | : Command: -sample-prob 7 | : Command: 1 8 | : Command: -min-turn-number-board-area-prop 9 | : Command: 0.15 10 | : Command: -force-sample-weight 11 | : Command: 10.0 12 | : Command: -hash-comments 13 | : Command: -training-weight 14 | : Command: 0.36 15 | : Command: -min-weight 16 | : Command: 0.01 17 | : Command: -turn-weight-lambda 18 | : Command: 0.01 19 | : Command: -for-testing 20 | : Found 2 sgf files! 21 | : Found 0 sgfs files! 22 | : Loaded 0 excludes 23 | : Kept 85 start positions 24 | : Excluded 0/2 sgf files 25 | : Filtered 0/2 sgf files 26 | : All done 27 | -------------------------------------------------------------------------------- /cpp/tests/results/sampletest-vf/log.log: -------------------------------------------------------------------------------- 1 | : Command: samplesgfs 2 | : Command: -sgfdir 3 | : Command: tests/data/sampletest/ 4 | : Command: -outdir 5 | : Command: tests/results/sampletest-vf/ 6 | : Command: -sample-prob 7 | : Command: 1 8 | : Command: -min-turn-number-board-area-prop 9 | : Command: 0.15 10 | : Command: -force-sample-weight 11 | : Command: 10.0 12 | : Command: -value-fluctuation-model 13 | : Command: tests/models/g170-b6c96-s175395328-d26788732.bin.gz 14 | : Command: -value-fluctuation-turn-scale 15 | : Command: 4.0 16 | : Command: -hash-comments 17 | : Command: -training-weight 18 | : Command: 0.46 19 | : Command: -min-weight 20 | : Command: 0.01 21 | : Command: -turn-weight-lambda 22 | : Command: 0 23 | : Command: -for-testing 24 | : Found 2 sgf files! 25 | : Found 0 sgfs files! 26 | : Loaded 0 excludes 27 | : nnRandSeed0 = forTesting 28 | : After dedups: nnModelFile0 = tests/models/g170-b6c96-s175395328-d26788732.bin.gz useFP16 auto useNHWC auto 29 | : Initializing neural net buffer to be size 19 * 19 allowing smaller boards 30 | : Cuda backend thread 0: Found GPU NVIDIA RTX A5000 memory 25425608704 compute capability major 8 minor 6 31 | : Cuda backend thread 0: Model version 8 useFP16 = true useNHWC = true 32 | : Cuda backend thread 0: Model name: g170-b6c96-s175395328-d26788732 33 | : Loaded neural net 34 | : Kept 82 start positions 35 | : Excluded 0/2 sgf files 36 | : Filtered 0/2 sgf files 37 | : totalWeightFromCount 51 38 | : totalWeightFromSurprise 0 39 | : totalWeightFromUncertainty 0 40 | : GPU -1 finishing, processed 64 rows 64 batches 41 | : All done 42 | -------------------------------------------------------------------------------- /cpp/tests/results/sampletest2-basic/log.log: -------------------------------------------------------------------------------- 1 | : Command: samplesgfs 2 | : Command: -sgfdir 3 | : Command: tests/data/sampletest2/ 4 | : Command: -outdir 5 | : Command: tests/results/sampletest2-basic/ 6 | : Command: -sample-prob 7 | : Command: 1 8 | : Command: -force-sample-weight 9 | : Command: 10.0 10 | : Command: -hash-comments 11 | : Command: -training-weight 12 | : Command: 0.36 13 | : Command: -min-weight 14 | : Command: 0.01 15 | : Command: -turn-weight-lambda 16 | : Command: 0.01 17 | : Command: -flip-if-pass 18 | : Command: -for-testing 19 | : Found 1 sgf files! 20 | : Found 0 sgfs files! 21 | : Loaded 0 excludes 22 | : Kept 32 start positions 23 | : Excluded 0/1 sgf files 24 | : Filtered 0/1 sgf files 25 | : All done 26 | -------------------------------------------------------------------------------- /cpp/tests/results/sampletest2-hint/0.hintposes.txt: -------------------------------------------------------------------------------- 1 | {"board":"........./........./....O..../...O.X.../...O.X.../...O.X.../........./........./........./","hintLoc":"G8","initialTurnNumber":7,"moveLocs":[],"movePlas":[],"nextPla":"W","weight":3.7601512627391194,"xSize":9,"ySize":9} 2 | {"board":"........./........./........./.....O.../........./...X...../........./........./........./","hintLoc":"C2","initialTurnNumber":2,"moveLocs":["pass","D6","F4","E7","D3","C3","E3"],"movePlas":["W","B","W","B","W","B","W"],"nextPla":"W","weight":2.6518196993903556,"xSize":9,"ySize":9} 3 | {"board":"........X/........O/........O/........O/........O/........O/........./........./........./","hintLoc":"J3","initialTurnNumber":6,"moveLocs":[],"movePlas":[],"nextPla":"W","weight":3.207152931979286,"xSize":9,"ySize":9} 4 | {"board":"........X/........O/........O/........O/........O/........O/........O/........./........./","hintLoc":"G1","initialTurnNumber":7,"moveLocs":["J2","J1","H1"],"movePlas":["W","B","W"],"nextPla":"W","weight":3.103604382194556,"xSize":9,"ySize":9} 5 | -------------------------------------------------------------------------------- /cpp/tests/testsearchcommon.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTSEARCHCOMMON_H 2 | #define TESTSEARCHCOMMON_H 3 | 4 | #include "../core/logger.h" 5 | #include "../game/boardhistory.h" 6 | #include "../neuralnet/nneval.h" 7 | #include "../search/asyncbot.h" 8 | 9 | namespace TestSearchCommon { 10 | 11 | std::string getSearchRandSeed(); 12 | 13 | struct TestSearchOptions { 14 | int numMovesInARow; 15 | bool printRootPolicy; 16 | bool printOwnership; 17 | bool printEndingScoreValueBonus; 18 | bool printPlaySelectionValues; 19 | bool printRootValues; 20 | bool printPrunedRootValues; 21 | bool printSharpScoreAndError; 22 | bool noClearBot; 23 | bool noClearCache; 24 | bool printMore; 25 | bool printMoreMoreMore; 26 | bool printAfterBegun; 27 | bool ignorePosition; 28 | bool printPostOrderNodeCount; 29 | Loc rootHintLoc; 30 | TestSearchOptions(); 31 | }; 32 | 33 | void printPolicyValueOwnership(const Board& board, const NNResultBuf& buf); 34 | 35 | void printBasicStuffAfterSearch(const Board& board, const BoardHistory& hist, const Search* search, PrintTreeOptions options); 36 | 37 | void runBotOnPosition(AsyncBot* bot, Board board, Player nextPla, BoardHistory hist, TestSearchOptions opts); 38 | 39 | void runBotOnSgf(AsyncBot* bot, const std::string& sgfStr, const Rules& defaultRules, int turnIdx, float overrideKomi, TestSearchOptions opts); 40 | 41 | NNEvaluator* startNNEval( 42 | const std::string& modelFile, Logger& logger, const std::string& seed, int nnXLen, int nnYLen, 43 | int defaultSymmetry, bool inputsUseNHWC, bool useNHWC, bool useFP16, bool debugSkipNeuralNet, 44 | bool requireExactNNLen 45 | ); 46 | 47 | void verifyTreePostOrder(Search* search, int onlyRequireAtLeast); 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /cpp/tests/tinymodel.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_TINYMODEL_H 2 | #define TESTS_TINYMODEL_H 3 | 4 | #include "../core/global.h" 5 | #include "../core/config_parser.h" 6 | #include "../core/logger.h" 7 | 8 | class NNEvaluator; 9 | 10 | namespace TinyModelTest { 11 | extern const char* tinyModelBase64Part0; 12 | extern const char* tinyModelBase64Part1; 13 | extern const char* tinyModelBase64Part2; 14 | extern const char* tinyModelBase64Part3; 15 | extern const char* tinyModelBase64Part4; 16 | extern const char* tinyModelBase64Part5; 17 | extern const char* tinyModelBase64Part6; 18 | 19 | extern const char* tinyMishModelBase64; 20 | 21 | NNEvaluator* runTinyModelTest(const std::string& baseDir, Logger& logger, ConfigParser& cfg, bool randFileName, double errorTolFactor); 22 | } 23 | 24 | 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /images/docs/bottlenecklonglonglongresblock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/bottlenecklonglonglongresblock.png -------------------------------------------------------------------------------- /images/docs/bottlenecklongresblock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/bottlenecklongresblock.png -------------------------------------------------------------------------------- /images/docs/bottlenecknestedresblock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/bottlenecknestedresblock.png -------------------------------------------------------------------------------- /images/docs/bottleneckresblock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/bottleneckresblock.png -------------------------------------------------------------------------------- /images/docs/chesstransposition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/chesstransposition.png -------------------------------------------------------------------------------- /images/docs/distantprobeoldpolicy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/distantprobeoldpolicy.png -------------------------------------------------------------------------------- /images/docs/doubleladderbreakoldpolicy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/doubleladderbreakoldpolicy.png -------------------------------------------------------------------------------- /images/docs/fixvariancescaleinit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/fixvariancescaleinit.png -------------------------------------------------------------------------------- /images/docs/fixvariancescaleinittrunk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/fixvariancescaleinittrunk.png -------------------------------------------------------------------------------- /images/docs/flyingdaggerfirstlineoldpolicy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/flyingdaggerfirstlineoldpolicy.png -------------------------------------------------------------------------------- /images/docs/maskconv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/maskconv.png -------------------------------------------------------------------------------- /images/docs/mcgsbad1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/mcgsbad1.png -------------------------------------------------------------------------------- /images/docs/mcgsbad2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/mcgsbad2.png -------------------------------------------------------------------------------- /images/docs/mcgsbad3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/mcgsbad3.png -------------------------------------------------------------------------------- /images/docs/mcgsbad4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/mcgsbad4.png -------------------------------------------------------------------------------- /images/docs/mcgsbad5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/mcgsbad5.png -------------------------------------------------------------------------------- /images/docs/mcts1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/mcts1.png -------------------------------------------------------------------------------- /images/docs/mcts2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/mcts2.png -------------------------------------------------------------------------------- /images/docs/mcts3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/mcts3.png -------------------------------------------------------------------------------- /images/docs/resblock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/resblock.png -------------------------------------------------------------------------------- /images/docs/vloss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/docs/vloss.png -------------------------------------------------------------------------------- /images/readme/jan2020vsjune2019.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/readme/jan2020vsjune2019.png -------------------------------------------------------------------------------- /images/readme/katajunevslz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/images/readme/katajunevslz.png -------------------------------------------------------------------------------- /misc/bots/kgs.txt: -------------------------------------------------------------------------------- 1 | AyaBot3 2 | AyaBotD1 3 | AyaBotD2 4 | AyaBotD3 5 | AyaBotD4 6 | AyaMC 7 | AyaMC2 8 | AyaMC3 9 | AyaMC5 10 | BadukTVint 11 | CrazyPhone 12 | CrazySton3 13 | CrazySton7 14 | CrazyStone 15 | CrazyStonT 16 | DarkGo 17 | GinseiIgo 18 | Golois3 19 | HelloBot 20 | HiraBot2 21 | HiraBot3 22 | HiraBot31 23 | HiraBot32 24 | HiraBot33 25 | HiraBot34 26 | HiraBot35 27 | HiraBot36 28 | HiraBot37 29 | HiraBot38 30 | HiraBot41 31 | HiraBot42 32 | HiraMC1 33 | ManyFaces 34 | Zen19 35 | Zen19A 36 | zen19BS 37 | Zen19K 38 | Zen19K2 39 | Zen19L 40 | Zen19X 41 | ZenLv8 42 | ZenLv9 43 | ZenLv5 44 | Zen19L 45 | HiraBot1 46 | ZenBot2 47 | HiraBot04 48 | HiraBot01 49 | AyaMC 50 | ZenBot3 51 | Golois4 52 | ZenLv6 53 | AyaBot5 54 | Golois 55 | ZenLv9 56 | Zen19X 57 | HiraBot02 58 | HiraBot2 59 | AyaBot4 60 | ZenLv7 61 | ZenLv8 62 | AyaMC3 63 | AyaBot3 64 | Golois3 65 | AyaBot2 66 | HiraBot36 67 | ZenBot4 68 | HiraBot35 69 | DCNN1d08 70 | DCNN1d07 71 | DCNN1d06 72 | HiraBot38 73 | HiraBot37 74 | DCNN1d05 75 | DCNN1d02 76 | DCNN1d03 77 | AyaBotD1 78 | DCNN1d04 79 | DCNN1d01 80 | AyaBotD2 81 | AyaMC2 82 | zen19BS 83 | HiraBot 84 | Golois2 85 | GinseiIgo 86 | ManyFaces 87 | Golois7 88 | HiraMC2 89 | HiraMC1 90 | HiraBot3 91 | HiraBot34 92 | HiraBot31 93 | HiraBot32 94 | HiraBot33 95 | Golois6 96 | AyaMC5 97 | AyaBotD3 98 | HiraBot44 99 | HiraBot43 100 | HiraBot42 101 | HiraBot41 102 | -------------------------------------------------------------------------------- /misc/bots/ogs.txt: -------------------------------------------------------------------------------- 1 | AyaGo 2 | AyaGo1 3 | AyaGo2 4 | AyaGo3 5 | AyaGo4 6 | AyaGo5 7 | AyaGo6 8 | AyaGo7 9 | BeginnerBot 10 | Billy (GnuGo lvl10) 11 | Fuego100k 12 | Fuego10k 13 | Fuego1k 14 | Fuego100 15 | Fuego1M 16 | Fuego10M 17 | GnuGo 18 | GnuGo2 19 | GnuGo3 20 | GnuGo4 21 | LibertyBot 22 | Nanny (GnuGo lvl5) 23 | Random Bot 24 | WeakBot50k 25 | -------------------------------------------------------------------------------- /python/clean_checkpoint.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | import sys 3 | import os 4 | import argparse 5 | import math 6 | import torch 7 | import json 8 | 9 | import katago.train.load_model 10 | 11 | description = """ 12 | Utility for cleaning torch checkpoints for release. 13 | """ 14 | 15 | parser = argparse.ArgumentParser(description=description) 16 | parser.add_argument('-checkpoint', help='Checkpoint file path', required=True) 17 | parser.add_argument('-output', help='Output checkpoint file path', required=True) 18 | args = vars(parser.parse_args()) 19 | 20 | checkpoint_path = args["checkpoint"] 21 | output_path = args["output"] 22 | 23 | data = torch.load(checkpoint_path,map_location="cpu") 24 | 25 | if "optimizer" in data: 26 | del data["optimizer"] 27 | 28 | if "running_metrics" in data: 29 | del data["running_metrics"] 30 | if "metrics" in data: 31 | del data["metrics"] 32 | 33 | if "train_state" in data: 34 | if "old_train_data_dirs" in data["train_state"]: 35 | del data["train_state"]["old_train_data_dirs"] 36 | if "data_files_used" in data["train_state"]: 37 | del data["train_state"]["data_files_used"] 38 | 39 | if "last_val_metrics" in data: 40 | del data["last_val_metrics"] 41 | 42 | torch.save(data, output_path) 43 | print(f"Cleaned {checkpoint_path} -> {output_path} for release") 44 | -------------------------------------------------------------------------------- /python/katago/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/python/katago/__init__.py -------------------------------------------------------------------------------- /python/katago/game/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/python/katago/game/__init__.py -------------------------------------------------------------------------------- /python/katago/train/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightvector/KataGo/aa58deb44fd8f141275897a1304c8c321233c3f8/python/katago/train/__init__.py -------------------------------------------------------------------------------- /python/katago/utils/push_back_generator.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | from typing import Generator, TypeVar, Generic 3 | 4 | T = TypeVar('T') 5 | 6 | class PushBackGenerator(Generic[T]): 7 | """Wrapper for generators that allows pushing items back on to the generator to be yielded next.""" 8 | def __init__(self, generator: Generator[T, None, None]): 9 | self._generator = generator 10 | self._stack = deque() 11 | self._orig_generator_empty = False 12 | 13 | def __iter__(self): 14 | return self 15 | 16 | def __next__(self) -> T: 17 | if self._stack: 18 | return self._stack.pop() 19 | if self._orig_generator_empty: 20 | raise StopIteration() 21 | try: 22 | return next(self._generator) 23 | except StopIteration: 24 | self._orig_generator_empty = True 25 | raise 26 | 27 | def push_back(self, item: T) -> None: 28 | self._stack.append(item) 29 | -------------------------------------------------------------------------------- /python/selfplay/shuffle_and_export_loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | set -o pipefail 3 | { 4 | if [[ $# -lt 6 ]] 5 | then 6 | echo "Usage: $0 NAMEPREFIX BASEDIR TMPDIR NTHREADS BATCHSIZE USEGATING" 7 | echo "NAMEPREFIX string prefix for this training run, try to pick something globally unique. Will be displayed to users when KataGo loads the model." 8 | echo "BASEDIR containing selfplay data and models and related directories" 9 | echo "TMPDIR scratch space, ideally on fast local disk, unique to this loop" 10 | echo "NTHREADS number of parallel threads/processes to use in shuffle" 11 | echo "BATCHSIZE number of samples to concat together per batch for training, must match training" 12 | echo "USEGATING = 1 to use gatekeeper, 0 to not use gatekeeper" 13 | exit 0 14 | fi 15 | NAMEPREFIX="$1" 16 | shift 17 | BASEDIRRAW="$1" 18 | shift 19 | TMPDIRRAW="$1" 20 | shift 21 | NTHREADS="$1" 22 | shift 23 | BATCHSIZE="$1" 24 | shift 25 | USEGATING="$1" 26 | shift 27 | 28 | GITROOTDIR="$(git rev-parse --show-toplevel)" 29 | 30 | basedir="$(realpath "$BASEDIRRAW")" 31 | tmpdir="$(realpath "$TMPDIRRAW")" 32 | 33 | mkdir -p "$basedir"/scripts 34 | mkdir -p "$basedir"/logs 35 | cp "$GITROOTDIR"/python/*.py "$GITROOTDIR"/python/selfplay/*.sh "$basedir"/scripts 36 | 37 | # For archival and logging purposes - you can look back and see exactly the python code on a particular date 38 | DATE_FOR_FILENAME=$(date "+%Y%m%d-%H%M%S") 39 | DATED_ARCHIVE="$basedir"/scripts/dated/"$DATE_FOR_FILENAME" 40 | mkdir -p "$DATED_ARCHIVE" 41 | cp "$GITROOTDIR"/python/*.py "$GITROOTDIR"/python/selfplay/*.sh "$DATED_ARCHIVE" 42 | 43 | ( 44 | cd "$basedir"/scripts 45 | while true 46 | do 47 | ./shuffle.sh "$basedir" "$tmpdir" "$NTHREADS" "$BATCHSIZE" "$@" 48 | sleep 20 49 | done 50 | ) >> "$basedir"/logs/outshuffle.txt 2>&1 & disown 51 | 52 | ( 53 | cd "$basedir"/scripts 54 | while true 55 | do 56 | ./export_model_for_selfplay.sh "$NAMEPREFIX" "$basedir" "$USEGATING" 57 | sleep 10 58 | done 59 | ) >> "$basedir"/logs/outexport.txt 2>&1 & disown 60 | 61 | exit 0 62 | } 63 | --------------------------------------------------------------------------------