Skip to content

Commit

Permalink
Use --device-id option
Browse files Browse the repository at this point in the history
  • Loading branch information
zakki committed May 4, 2018
1 parent 133bfcb commit 14cbff2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/UctSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@ SetDeviceId(const int id)
device_id = id;
}

int
GetDeviceId()
{
return device_id;
}

void
SetNoExpand(bool flag)
{
Expand Down
2 changes: 2 additions & 0 deletions src/UctSearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ void SetUseNN(bool flag);

void SetDeviceId( const int id );

int GetDeviceId();

// Policy networkの手を打つ
int PolicyNetworkGenmove(game_info_t *game, int color);

Expand Down
5 changes: 5 additions & 0 deletions src/lz/Leela.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ void benchmark(GameState& game) {
#endif

extern char uct_params_path[1024];
extern int GetDeviceId();

int InitializeLeela() {
auto input = std::string{};
Expand All @@ -366,6 +367,10 @@ int InitializeLeela() {
cfg_weightsfile = uct_params_path;
cfg_weightsfile += "/lz.bin";

int device_id = GetDeviceId();
if (device_id >= 0)
cfg_gpus.push_back(device_id);

init_global_objects();

#if 0
Expand Down

0 comments on commit 14cbff2

Please sign in to comment.