Compiler flags for max field size and sgf selfplay/gatekeeper names#41
Compiler flags for max field size and sgf selfplay/gatekeeper names#41
Conversation
607b707 to
3a9ee40
Compare
3a9ee40 to
032c843
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces timestamp-aware file naming and seeds for selfplay/gatekeeper, improves compilation metadata reporting, adds configurable compile-time board-size limits, enhances rules presets (including Dots variants), and extends CI/build support (including Eigen backend).
Changes:
- Add
TimeStampHandlerand wire it into selfplay/gatekeeper/training-data writing to generate deterministic, collision-resistant filenames and seeds, plus switch compile-time reporting to a numericYYYY-MM-DD-HH-MM-SSformat. - Refactor rules handling to use named presets (including new Dots presets like
bbs/notago), addRules::operator<, and improve GTP capabilities (newinfocommand, Dots config cleanup). - Update CMake and CI to allow configurable
COMPILE_MAX_BOARD_LEN*compiler flags and to build/test both OpenCL and Eigen backends, including a runtime Eigen-thread sanity check.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cpp/tests/testtrainingwrite.cpp | Adjusts the createTestTrainingDataWriter helper to pass the new TimeStampHandler* parameter (as nullptr) to the updated TrainingDataWriter constructor. |
| cpp/neuralnet/trtbackend.cpp | Refactors buildActivationLayer to use straight if chains with a single ASSERT_UNREACHABLE and a nullptr return for unknown activations, improving control-flow clarity and return-path completeness. |
| cpp/main.h | Declares Version::getCompilationDateTime(bool csv = false) as part of the version/build metadata API. |
| cpp/main.cpp | Adds Eigen backend support in main (including a thread-count check and user guidance) and switches compile-time reporting to use the new getCompilationDateTime helper with numeric formatting. |
| cpp/game/rules.h | Adds bool operator<(const Rules& other) const; to support ordered containers over Rules (e.g., std::map<Rules, string> for presets). |
| cpp/game/rules.cpp | Implements Rules::operator<, introduces preset maps and initializePresets(), rewrites parseRulesHelper and toStringNoSgfDefinedPropertiesMaybeNice to use presets (including new Dots presets like bbs/notago), and integrates them into existing parsing APIs. |
| cpp/game/common.h | Adds Dots-specific rule name constants DOTS_NOTAGO_STANDARD_RULES ("notago") and DOTS_BBS_STANDARD_RULES ("bbs") used by the new presets. |
| cpp/dataio/trainingwrite.h | Extends TrainingDataWriter’s constructor signature to accept a TimeStampHandler*, stores it in the class, and makes minor formatting tweaks. |
| cpp/dataio/trainingwrite.cpp | Wires the TimeStampHandler* into TrainingDataWriter to generate timestamped .npz filenames when available, leaving the old random-hex naming as a fallback when no handler is provided. |
| cpp/core/datetime.cpp | Changes DateTime::getCompactDateTimeString() format to YYYY-MM-DD-HH-MM-SS, aligning with the desired compact, numeric timestamp format for filenames and compile-time reporting. |
| cpp/core/TimeStampHandler.h | Introduces the TimeStampHandler class interface for generating timestamped filenames and an associated random seed derived from the timestamp. |
| cpp/core/TimeStampHandler.cpp | Implements TimeStampHandler, generating a compact timestamp plus a short random suffix, ensuring both cross-machine uniqueness and local collision avoidance via existence checks. |
| cpp/configs/gtp_dots.cfg | Removes the now-unnecessary rules = dots line so Dots configurations rely on the dots flag and rule presets instead of a special string rule name. |
| cpp/command/selfplay.cpp | Integrates TimeStampHandler into selfplay: log filenames, model config dumps, training-data filenames (TrainingDataWriter), SGF output, and game seeds are now based on a shared timestamp-derived seed. |
| cpp/command/gtp.cpp | Adds a new info GTP command (and includes it in knownCommands) that returns CSV-style app/build info plus current model internal names. |
| cpp/command/gatekeeper.cpp | Integrates TimeStampHandler into gatekeeper: log filenames, per-model config dumps, and SGF output now use timestamped filenames, and a timestamp-derived seed is available (currently only used for logging/seeding consistency). |
| cpp/CMakeLists.txt | Adds core/TimeStampHandler.cpp to the build, and introduces configurable COMPILE_MAX_BOARD_LEN_X/Y for DOTS_GAME and COMPILE_MAX_BOARD_LEN when using USE_BIGGER_BOARDS_EXPENSIVE, with helpful status messages. |
| .github/workflows/build.yml | Updates the Linux build workflow to build with both OPENCL and EIGEN backends via a matrix, installs Eigen dev headers, keys CMake cache by backend, and names artifacts per backend. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
032c843 to
68b8235
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cpp/core/TimeStampHandler.h
Outdated
|
|
||
| using namespace std; | ||
|
|
||
| class TimeStampHandler { | ||
| public: | ||
| explicit TimeStampHandler(Rand& rand); | ||
| [[nodiscard]] string generateFileName(const string& path, const string& ext) const; | ||
| [[nodiscard]] string getCurrentRandSeed() const; | ||
|
|
||
| private: | ||
| string currentDateTime; | ||
| uint64_t currentDateTimeRand; | ||
| string currentRandSeed; | ||
| string fileNameFriendlyRandSuffix; |
There was a problem hiding this comment.
Avoid using namespace std; in a header file, since it injects all of std into every translation unit that includes this header and can cause name collisions; prefer qualifying with std:: or using using declarations only in source files.
| using namespace std; | |
| class TimeStampHandler { | |
| public: | |
| explicit TimeStampHandler(Rand& rand); | |
| [[nodiscard]] string generateFileName(const string& path, const string& ext) const; | |
| [[nodiscard]] string getCurrentRandSeed() const; | |
| private: | |
| string currentDateTime; | |
| uint64_t currentDateTimeRand; | |
| string currentRandSeed; | |
| string fileNameFriendlyRandSuffix; | |
| #include <string> | |
| #include <cstdint> | |
| class TimeStampHandler { | |
| public: | |
| explicit TimeStampHandler(Rand& rand); | |
| [[nodiscard]] std::string generateFileName(const std::string& path, const std::string& ext) const; | |
| [[nodiscard]] std::string getCurrentRandSeed() const; | |
| private: | |
| std::string currentDateTime; | |
| std::uint64_t currentDateTimeRand; | |
| std::string currentRandSeed; | |
| std::string fileNameFriendlyRandSuffix; |
cpp/main.cpp
Outdated
| { | ||
| #ifdef USE_EIGEN_BACKEND | ||
| if(Eigen::nbThreads() == 0) { | ||
| cout << "There is no Eigen threads." << endl; |
There was a problem hiding this comment.
The message text "There is no Eigen threads." is ungrammatical; consider changing it to something like "There are no Eigen threads." for clarity.
| cout << "There is no Eigen threads." << endl; | |
| cout << "There are no Eigen threads." << endl; |
68b8235 to
024c89d
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
024c89d to
63780ce
Compare
No description provided.