Skip to content

Commit

Permalink
Merge branch 'phoenix-orig' into NN-eval-update
Browse files Browse the repository at this point in the history
  • Loading branch information
alreadydone authored Jul 8, 2018
2 parents d25f752 + 5c464a5 commit c168c12
Show file tree
Hide file tree
Showing 35 changed files with 892 additions and 334 deletions.
44 changes: 31 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cmake_minimum_required(VERSION 3.1)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

project(leelaz)
add_subdirectory(gtest EXCLUDE_FROM_ALL) # We don't want to install gtest, exclude it from `all`
#add_subdirectory(gtest EXCLUDE_FROM_ALL) # We don't want to install gtest, exclude it from `all`

# Required Packages
set(Boost_MIN_VERSION "1.58.0")
Expand Down Expand Up @@ -123,15 +123,33 @@ else()
endif()

# Google Test below
file(GLOB tests_SRC "${SrcPath}/tests/*.cpp")

add_executable(tests ${tests_SRC} $<TARGET_OBJECTS:objs>)
if(GccSpecificFlags)
target_compile_options(tests PRIVATE "-Wno-unused-variable")
endif()

target_link_libraries(tests ${Boost_LIBRARIES})
target_link_libraries(tests ${BLAS_LIBRARIES})
target_link_libraries(tests ${OpenCL_LIBRARIES})
target_link_libraries(tests ${ZLIB_LIBRARIES})
target_link_libraries(tests gtest_main ${CMAKE_THREAD_LIBS_INIT})
#file(GLOB tests_SRC "${SrcPath}/tests/*.cpp")

#add_executable(tests ${tests_SRC} $<TARGET_OBJECTS:objs>)
#if(GccSpecificFlags)
# target_compile_options(tests PRIVATE "-Wno-unused-variable")
#endif()

#target_link_libraries(tests ${Boost_LIBRARIES})
#target_link_libraries(tests ${BLAS_LIBRARIES})
#target_link_libraries(tests ${OpenCL_LIBRARIES})
#target_link_libraries(tests ${ZLIB_LIBRARIES})
#target_link_libraries(tests gtest_main ${CMAKE_THREAD_LIBS_INIT})

include(GetGitRevisionDescription)
git_describe(VERSION --tags)
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" MAJOR_VERSION "${VERSION}")
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" MINOR_VERSION "${VERSION}")

SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_NAME "leelaz")
SET(CPACK_DEBIAN_PACKAGE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}")
SET(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Gian-Carlo Pascutto https://github.com/gcp/leela-zero")
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Go engine with no human-provided knowledge, modeled after the AlphaGo Zero paper.")
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
SET(CPACK_DEBIAN_PACKAGE_SECTION "games")
SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}")

INCLUDE(CPack)
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,19 @@ The engine supports the [GTP protocol, version 2](https://www.lysator.liu.se/~gu
Leela Zero is not meant to be used directly. You need a graphical interface
for it, which will interface with Leela Zero through the GTP protocol.

[Lizzie](https://github.com/featurecat/lizzie/releases) is a client specifically
for Leela Zero which shows live search probilities, a win rate graph, and has
an automatic game analysis mode. Has binaries for Windows, Mac, and Linux.

[Sabaki](http://sabaki.yichuanshen.de/) is a very nice looking GUI with GTP 2
capability. It should work with this engine. A lot of go software can
interface to an engine via GTP, so look around.
capability.

[LeelaSabaki](https://github.com/SabakiHQ/LeelaSabaki) is modified to
show variations and winning statistics in the game tree, as well as a heatmap
on the game board.

A lot of go software can interface to an engine via GTP,
so look around.

Add the --gtp commandline option on the engine command line to enable Leela
Zero's GTP support. You will need a weights file, specify that with the -w option.
Expand Down Expand Up @@ -281,11 +291,14 @@ If interrupted, training can be resumed with:

# Todo

- [ ] List of package names for more distros
- [ ] Multi-GPU support for training
- [ ] Optimize Winograd transformations
- [ ] CUDA specific version using cuDNN
- [ ] AMD specific version using MIOpen
- [ ] Optimize Winograd transformations.
- [ ] Implement GPU batching.
- [ ] Parameter setting over GTP.
- More backends:
- [ ] Eigen based BLAS backend.
- [ ] MKL-DNN based backend.
- [ ] CUDA specific version using cuDNN.
- [ ] AMD specific version using MIOpen.

# Related links

Expand Down
4 changes: 4 additions & 0 deletions autogtp/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <QFile>
#include <QTextStream>
#include <QRegularExpression>
#include <QFileInfo>
#include "Game.h"

Game::Game(const QString& weights, const QString& opt, const QString& binary) :
Expand All @@ -36,6 +37,9 @@ Game::Game(const QString& weights, const QString& opt, const QString& binary) :
#ifdef WIN32
m_binary.append(".exe");
#endif
if (!QFileInfo::exists(m_binary)) {
m_binary.remove(0, 2); // ./leelaz -> leelaz
}
m_cmdLine = m_binary + " " + opt + " " + weights;
m_fileName = QUuid::createUuid().toRfc4122().toHex();
}
Expand Down
41 changes: 0 additions & 41 deletions autogtp/Keypress.cpp

This file was deleted.

37 changes: 0 additions & 37 deletions autogtp/Keypress.h

This file was deleted.

10 changes: 10 additions & 0 deletions autogtp/Management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,16 @@ void Management::runTuningProcess(const QString &tuneCmdLine) {
tuneProcess.waitForStarted(-1);
while (tuneProcess.state() == QProcess::Running) {
tuneProcess.waitForReadyRead(1000);
QByteArray text = tuneProcess.readAllStandardOutput();
int version_start = text.indexOf("Leela Zero ") + 11;
if (version_start > 10) {
int version_end = text.indexOf(" ", version_start);
m_leelaversion = QString(text.mid(version_start, version_end - version_start));
}
QTextStream(stdout) << text;
QTextStream(stdout) << tuneProcess.readAllStandardError();
}
QTextStream(stdout) << "Found Leela Version : " << m_leelaversion << endl;
tuneProcess.waitForFinished(-1);
}

Expand Down Expand Up @@ -316,6 +324,8 @@ Order Management::getWorkInternal(bool tuning) {
prog_cmdline.append("0");
} else {
prog_cmdline.append(QString::number(AUTOGTP_VERSION));
if (!m_leelaversion.isEmpty())
prog_cmdline.append("/"+m_leelaversion);
}
QProcess curl;
curl.start(prog_cmdline);
Expand Down
1 change: 1 addition & 0 deletions autogtp/Management.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public slots:
int m_threadsLeft;
bool m_delNetworks;
QLockFile *m_lockFile;
QString m_leelaversion;

Order getWorkInternal(bool tuning);
Order getWork(bool tuning = false);
Expand Down
1 change: 1 addition & 0 deletions autogtp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ autogtp.
cp ../src/leelaz .
./autogtp

While autogtp is running, typing q+Enter will save the processed data and exit. When autogtp runs next, autogtp will continue the game.
14 changes: 7 additions & 7 deletions autogtp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ int main(int argc, char *argv[]) {
if (parser.isSet(timeoutOption)) {
QObject::connect(timer, &QTimer::timeout, &app, &QCoreApplication::quit);
timer->start(parser.value(timeoutOption).toInt() * 60000);
} else {
if (parser.isSet(singleOption) || parser.isSet(maxOption)) {
QObject::connect(boss, &Management::sendQuit, &app, &QCoreApplication::quit);
} else {
cons = new Console();
QObject::connect(cons, &Console::sendQuit, &app, &QCoreApplication::quit);
}
}
if (parser.isSet(singleOption) || parser.isSet(maxOption)) {
QObject::connect(boss, &Management::sendQuit, &app, &QCoreApplication::quit);
}
if (true) {
cons = new Console();
QObject::connect(cons, &Console::sendQuit, &app, &QCoreApplication::quit);
}
return app.exec();
}
Loading

0 comments on commit c168c12

Please sign in to comment.