Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Limbo to work on windows. #324

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/limbo/bayes_opt/bo_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
#include <Eigen/Core>

// we need everything to have the defaults
#define _USE_MATH_DEFINES // This makes sure to bring in the M_PI define which is not in the C or C++ standard and is not defined by default on Windows.
#include <limbo/acqui/ucb.hpp>
#include <limbo/init/random_sampling.hpp>
#include <limbo/kernel/exp.hpp>
Expand Down
11 changes: 11 additions & 0 deletions src/limbo/tools/sys.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@

#include <ctime>
#include <string>
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif

namespace limbo {
namespace tools {
Expand All @@ -69,9 +73,16 @@ namespace limbo {
inline std::string hostname()
{
char hostname[50];
#ifdef _WIN32
DWORD buffCharCount = 50;
bool ok = GetComputerNameA(hostname, &buffCharCount);
assert(ok);
#else
int res = gethostname(hostname, 50);
assert(res == 0);
res = 0; // avoid a warning in opt mode
#endif

return std::string(hostname);
}

Expand Down