Skip to content

Windows Migration#219

Open
studentgoose wants to merge 20 commits intosail-sg:mainfrom
studentgoose:master
Open

Windows Migration#219
studentgoose wants to merge 20 commits intosail-sg:mainfrom
studentgoose:master

Conversation

@studentgoose
Copy link
Collaborator

@studentgoose studentgoose commented Nov 3, 2022

Description

I attempt to migrate envpool to the Windows environment.

Motivation and Context

Why is this change required? What problem does it solve?

See details of my progress and Windows Environment setup in WINDOWS.md

If it fixes an open issue, please link to the issue here. close #168
You can use the syntax close #233 if this solves the issue #233

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds core functionality)
  • New environment (non-breaking change which adds 3rd-party environment)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)
  • Example (update in the folder of example)

Implemented Tasks

Details in WINDOWS.md

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

  • I have read the CONTRIBUTION guide (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.
  • I have reformatted the code using make format (required)
  • I have checked the code using make lint (required)
  • I have ensured make bazel-test pass. (required)

Comment on lines +109 to +118

// The following does not work under Windows. Need to find alternatives.
// for (std::size_t tid = 0; tid < num_threads_; ++tid) {
// cpu_set_t cpuset;
// CPU_ZERO(&cpuset);
// std::size_t cid = (thread_affinity_offset + tid) % processor_count;
// CPU_SET(cid, &cpuset);
// pthread_setaffinity_np(workers_[tid].native_handle(), sizeof(cpu_set_t),
// &cpuset);
// }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use #ifdef


maybe(
http_archive,
name = "mujoco",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name = "mujoco",
name = "mujoco_windows",

Comment on lines +20 to +22
cuda_dir = rctx.os.environ.get(_CUDA_DIR, default = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7")
""" rctx.symlink("{}/include".format(cuda_dir), "include")
rctx.symlink("{}/lib64".format(cuda_dir), "lib64") """
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use sth like if windows: xxx; elif linux: xxx

.bazelrc Outdated
build --action_env=BAZEL_LINKOPTS=-static-libgcc
build --action_env=CUDA_DIR=/usr/local/cuda
build --incompatible_strict_action_env --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --client_env=BAZEL_CXXOPTS=-std=c++17
build --incompatible_strict_action_env --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 --client_env=BAZEL_CXXOPTS=/std:c++17
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure the best practice here, @mavenlin can you take a look?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember tensorflow use the same mechanism, but they have some fancy config script to detect cuda and generate the bazelrc.

@mavenlin
Copy link
Member

mavenlin commented Dec 9, 2022

This StackOverflow thread has good examples and links on how to conditionally config bazel for windows. https://stackoverflow.com/questions/48860910/how-to-use-select-to-properly-detect-whether-i-am-building-c-code-in-windows-o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Py3.10, Windows and MacOS support

3 participants