-
Notifications
You must be signed in to change notification settings - Fork 104
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
Windows Migration #219
Open
peilinrao
wants to merge
20
commits into
sail-sg:main
Choose a base branch
from
peilinrao:master
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Windows Migration #219
Changes from 3 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ced0f05
test
peilinrao 2b70a4e
sync
peilinrao 75fef38
cuda can work rn
peilinrao 5b3c151
Utils Box2d Classic_control toy_text now all can work on windows
peilinrao 00c6151
fix a bug in mojoco env
peilinrao 20387d8
Working on Windows-Linux Compatibility
peilinrao 95aab73
Compatibility for mujoco fixed, Subject to Linux Test
peilinrao 6063d2d
windows merge test
peilinrao da2ce9c
something is deeply wrong in bazelrc
peilinrao 3a10571
updating rc files
peilinrao 6e66558
.
peilinrao 8a9c5ca
fixing xla.h
peilinrao f1d8fde
xla
peilinrao dfeca9e
dummy compatible test
peilinrao c612127
same as above
peilinrao 7086a61
same as above
peilinrao 0cfc305
same as above
peilinrao bb4aabf
same as above
peilinrao 5efb4f9
same as above
peilinrao 1f18a94
update documents, ready for PR
peilinrao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ py_binary( | |
requirement("wheel"), | ||
], | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Windows Migration | ||
|
||
Note that this merge request only intends to work on Windows. I haven't write code that switch support between linux and Windows. I'll update that feature after the whole thing can be build on Windows. | ||
|
||
## Setup Environment On Windows | ||
|
||
1. Install [Windows Powershell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2). Do step 2 and 3 in Powershell. | ||
2. Install [choco](https://chocolatey.org/install#individual) | ||
3. Install bazelisk/bazel ``` choco install bazelisk``` | ||
4. Install [MinGW-w64](https://www.mingw-w64.org/) | ||
5. Install [git bash](https://gitforwindows.org/) and make sure it uses MINGW64 emulation. Do all the following steps in bash. | ||
6. Install [VC++ 2017](https://www.google.com/url?q=https://aka.ms/vs/15/release/vs_buildtools.exe&sa=D&source=docs&ust=1667504254128145&usg=AOvVaw3jOTmoHfuzAHgaScSgsmlE) on Windows | ||
7. Install python 3.10 (instead of 3.11 because pygame installation fails on Windows) | ||
8. Go where python.exe is installed, make a copy of python.exe and rename it python3.exe (it would bypass the bug "python interpreter cannot be found with requirement") | ||
9. Install [swig.exe](https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.1.0/swigwin-4.1.0.zip/download?use_mirror=gigenet) and merge it into python folder and do [some hacks](https://stackoverflow.com/questions/44504899/installing-pocketsphinx-python-module-command-swig-exe-failed) | ||
10. Install [Clang](https://bazel.build/configure/windows#using) and follow this [link](https://github.com/llvm/llvm-project/releases/tag/llvmorg-15.0.2). Don't forget to set BAZEL_VC and BAZEL_LLVM in environmental variable manually. | ||
11. Now you can run some tests | ||
```bazel build --test_output=all //envpool/dummy:dummy_envpool_test --config=debug --compiler=clang-cl``` | ||
|
||
|
||
|
||
## Parts that built successfully | ||
- [x] Dummy | ||
- [x] Utils | ||
- [x] Box2d | ||
- [x] Classic Control | ||
- [x] Mujoco:mujoco_gym-env | ||
- [ ] Mujoco:mujoco_dmc_env: no matching function for call to 'mj_loadXML', use of undeclared identifier 'M_PI'... | ||
- [ ] Atari:atari_env #include <dlfcn.h> not found | ||
- [ ] Toy_text fatal error: 'cuda_runtime_api.h' file not found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,14 +106,16 @@ class AsyncEnvPool : public EnvPool<typename Env::Spec> { | |
if (spec.config["thread_affinity_offset"_] >= 0) { | ||
std::size_t thread_affinity_offset = | ||
spec.config["thread_affinity_offset"_]; | ||
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); | ||
} | ||
|
||
// 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); | ||
// } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ pybind_extension( | |
deps = [ | ||
":toy_text_env", | ||
"//envpool/core:py_envpool", | ||
"//envpool/core:xla", | ||
], | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -18,6 +18,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | |||||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") | ||||||
load("//third_party/cuda:cuda.bzl", "cuda_configure") | ||||||
|
||||||
|
||||||
def workspace(): | ||||||
"""Load requested packages.""" | ||||||
maybe( | ||||||
|
@@ -318,13 +319,21 @@ def workspace(): | |||||
|
||||||
maybe( | ||||||
http_archive, | ||||||
name = "mujoco", | ||||||
name = "mujoco_linux", | ||||||
sha256 = "d1cb3a720546240d894cd315b7fd358a2b96013a1f59b6d718036eca6f6edac2", | ||||||
strip_prefix = "mujoco-2.2.1", | ||||||
urls = [ | ||||||
"https://github.com/deepmind/mujoco/releases/download/2.2.1/mujoco-2.2.1-linux-x86_64.tar.gz", | ||||||
"https://ml.cs.tsinghua.edu.cn/~jiayi/envpool/deepmind/mujoco/mujoco-2.2.1-linux-x86_64.tar.gz", | ||||||
], | ||||||
"https://github.com/deepmind/mujoco/releases/download/2.2.1/mujoco-2.2.1-linux-x86_64.tar.gz", | ||||||
"https://ml.cs.tsinghua.edu.cn/~jiayi/envpool/deepmind/mujoco/mujoco-2.2.1-linux-x86_64.tar.gz", | ||||||
], | ||||||
build_file = "//third_party/mujoco:mujoco.BUILD", | ||||||
) | ||||||
|
||||||
maybe( | ||||||
http_archive, | ||||||
name = "mujoco", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
sha256 = "e0068d25fdb00ec3afa53e429b5eff438d222455603bafa080086abaf11fe16f", | ||||||
urls = ["https://github.com/deepmind/mujoco/releases/download/2.2.1/mujoco-2.2.1-windows-x86_64.zip"], | ||||||
build_file = "//third_party/mujoco:mujoco.BUILD", | ||||||
) | ||||||
|
||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.