Skip to content

Commit

Permalink
kick version to 0.41.01
Browse files Browse the repository at this point in the history
[skip_fishtest]
  • Loading branch information
dhbloo committed Jun 7, 2024
1 parent 9da0661 commit a179f40
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Rapfi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ set(CORE_SOURCES
core/iohelper.cpp
core/utils.cpp
core/platform.cpp
core/version.cpp

database/dbclient.cpp
database/dbutils.cpp
Expand Down Expand Up @@ -93,7 +94,6 @@ set(HEADERS
core/pos.h
core/types.h
core/utils.h
core/version.h

database/cache.h
database/dbclient.h
Expand Down
5 changes: 2 additions & 3 deletions Rapfi/command/gomocup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "../config.h"
#include "../core/iohelper.h"
#include "../core/utils.h"
#include "../core/version.h"
#include "../database/dbclient.h"
#include "../database/dbutils.h"
#include "../database/yxdbstorage.h"
Expand Down Expand Up @@ -170,7 +169,7 @@ void think(Board &board,

void setGUIMode()
{
MESSAGEL("Rapfi Engine Ver " CURRENT_VER);
MESSAGEL("Rapfi " << getVersionInfo());
MESSAGEL("INFO MAX_THREAD_NUM 256");
MESSAGEL("INFO MAX_HASH_SIZE 30");
GUIMode = true;
Expand Down Expand Up @@ -1280,7 +1279,7 @@ extern "C" bool gomocupLoopOnce()
&& cmd != "YXQUERYDATABASEALLT") Search::Threads.stopThinking();

if (cmd == "END") return true;
else if (cmd == "ABOUT") std::cout << EngineInfo << std::endl;
else if (cmd == "ABOUT") std::cout << getEngineInfo() << std::endl;
else if (cmd == "START") start();
else if (cmd == "RECTSTART") rectStart();
else if (cmd == "INFO") getOption();
Expand Down
5 changes: 2 additions & 3 deletions Rapfi/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "command/command.h"
#include "core/iohelper.h"
#include "core/version.h"
#include "database/dbstorage.h"
#include "database/yxdbstorage.h"
#include "eval/evaluator.h"
Expand Down Expand Up @@ -273,8 +272,8 @@ bool Config::loadConfig(std::istream &configStream, bool skipModelLoading)
/// This is used to check if the config file is suitable for current version of Rapfi.
void Config::readRequirement(const cpptoml::table &t)
{
uint64_t rapVer = ((uint64_t)RAPFI_MAJOR_VER << 32) | ((uint64_t)RAPFI_MINOR_VER << 16)
| (uint64_t)RAPFI_REVISION_VER;
auto [major, minor, revision] = getVersionNumbers();
uint64_t rapVer = ((uint64_t)major << 32) | ((uint64_t)minor << 16) | (uint64_t)revision;
if (auto minVer = t.get_array_of<int64_t>("min_version")) {
if (minVer->size() != 3)
throw std::runtime_error("illegal min_version");
Expand Down
12 changes: 12 additions & 0 deletions Rapfi/core/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,15 @@ std::vector<std::string> makeFileListFromPathList(const std::vector<std::string>
/// If raiseException is true, when failed to create, an filesystem::filesystem_error is raised.
/// @return Whether directory exists (or created) if raiseException is false.
bool ensureDir(std::string dirpath, bool raiseException = true);

// -------------------------------------------------
// Engine Version

/// Returns the engine major/minor/revision version numbers.
std::tuple<int, int, int> getVersionNumbers();

/// Returns the engine version information.
std::string getVersionInfo();

/// Returns the engine information.
std::string getEngineInfo();
120 changes: 120 additions & 0 deletions Rapfi/core/version.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*
* Rapfi, a Gomoku/Renju playing engine supporting piskvork protocol.
* Copyright (C) 2022 Rapfi developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "utils.h"

#include <sstream>

#define RAPFI_MAJOR_VER 0
#define RAPFI_MINOR_VER 41
#define RAPFI_REVISION_VER 01

#define MACRO_STR(s) #s
#define VERSION_STR(a, b, c) MACRO_STR(a) "." MACRO_STR(b) "." MACRO_STR(c)
#define VERSION_STR2(a, b) MACRO_STR(a) "." MACRO_STR(b)
#define CURRENT_VER VERSION_STR(RAPFI_MAJOR_VER, RAPFI_MINOR_VER, RAPFI_REVISION_VER)

std::tuple<int, int, int> getVersionNumbers()
{
return {RAPFI_MAJOR_VER, RAPFI_MINOR_VER, RAPFI_REVISION_VER};
}

std::string getBuildInfo()
{
std::stringstream ss;

#if defined(__INTEL_LLVM_COMPILER)
ss << "ICX " << MACRO_STR(__INTEL_LLVM_COMPILER);
#elif defined(__clang__)
ss << "clang++ " << VERSION_STR(__clang_major__, __clang_minor__, __clang_patchlevel__);
#elif _MSC_VER
ss << "MSVC " << VERSION_STR2(_MSC_FULL_VER, _MSC_BUILD);
#elif __GNUC__
ss << "g++ " << VERSION_STR(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#else
ss << "Unknown compiler";
#endif

#if defined(__APPLE__)
ss << " on Apple";
#elif defined(__MINGW64__)
ss << " on MinGW64";
#elif defined(__ANDROID__)
ss << " on Android";
#elif defined(__linux__)
ss << " on Linux";
#elif defined(_WIN64) || defined(_WIN32)
ss << " on Windows";
#elif defined(__EMSCRIPTEN__)
ss << " on Wasm";
#else
ss << " on unknown system";
#endif

#if defined(USE_SSE)
ss << " SSE41";
#endif
#if defined(USE_AVX2)
ss << " AVX2";
#endif
#if defined(USE_AVX512)
ss << " AVX512";
#endif
#if defined(USE_BMI2)
ss << " BMI2";
#endif
#if defined(USE_VNNI)
ss << " VNNI";
#endif
#if defined(USE_NEON_DOTPROD)
compiler += " NEON_DOTPROD";
#elif defined(USE_NEON)
compiler += " NEON";
#endif

#if !defined(MULTI_THREADING)
ss << " SINGLE_THREAD";
#endif

#if defined(NO_PREFETCH)
ss << " NO_PREFETCH";
#endif

#if !defined(NDEBUG)
ss << " DEBUG";
#endif

return ss.str();
}

std::string getVersionInfo()
{
std::stringstream ss;
ss << CURRENT_VER << " (" << getBuildInfo() << ')';
return ss.str();
}

std::string getEngineInfo()
{
std::stringstream ss;
ss << "name=\"Rapfi\", ";
ss << "version=\"" << getVersionInfo() << "\", ";
ss << "author=\"Rapfi developers (see AUTHORS file)\", ";
ss << "country=\"China\"";
return ss.str();
}
32 changes: 0 additions & 32 deletions Rapfi/core/version.h

This file was deleted.

1 change: 0 additions & 1 deletion Rapfi/search/hashtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "../core/iohelper.h"
#include "../core/utils.h"
#include "../core/version.h"
#include "searchthread.h"

#include <cassert>
Expand Down

0 comments on commit a179f40

Please sign in to comment.