mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 23:57:45 +08:00
Add Optional Fast Build Configuration (#8925)
* Fast builds by default * Update doc/source/development.rst Co-authored-by: Simon Mo <xmo@berkeley.edu> Co-authored-by: Mehrdad <noreply@github.com> Co-authored-by: Simon Mo <xmo@berkeley.edu>
This commit is contained in:
@@ -26,6 +26,18 @@ from ray.includes.function_descriptor cimport (
|
||||
CFunctionDescriptor,
|
||||
)
|
||||
|
||||
cdef extern from *:
|
||||
"""
|
||||
#if __OPTIMIZE__ && __OPTIMIZE__ == 1
|
||||
#undef __OPTIMIZE__
|
||||
int __OPTIMIZE__ = 1;
|
||||
#define __OPTIMIZE__ 1
|
||||
#else
|
||||
int __OPTIMIZE__ = 0;
|
||||
#endif
|
||||
"""
|
||||
int __OPTIMIZE__
|
||||
|
||||
cdef extern from "Python.h":
|
||||
# Note(simon): This is used to configure asyncio actor stack size.
|
||||
# Cython made PyThreadState an opaque types. Saying that if the user wants
|
||||
|
||||
@@ -109,6 +109,8 @@ include "includes/serialization.pxi"
|
||||
include "includes/libcoreworker.pxi"
|
||||
include "includes/global_state_accessor.pxi"
|
||||
|
||||
# Expose GCC & Clang macro to report whether C++ optimizations were enabled during compilation.
|
||||
OPTIMIZED = __OPTIMIZE__
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
"""This is the script for `ray microbenchmark`."""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
import numpy as np
|
||||
import multiprocessing
|
||||
import ray
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Only run tests matching this filter pattern.
|
||||
filter_pattern = os.environ.get("TESTS_TO_RUN", "")
|
||||
|
||||
@@ -89,7 +92,21 @@ def timeit(name, fn, multiplier=1):
|
||||
round(np.std(stats), 2))
|
||||
|
||||
|
||||
def check_optimized_build():
|
||||
if not ray._raylet.OPTIMIZED:
|
||||
msg = ("WARNING: Unoptimized build! "
|
||||
"To benchmark an optimized build, try:\n"
|
||||
"\tbazel build -c opt //:ray_pkg\n"
|
||||
"You can also make this permanent by adding\n"
|
||||
"\tbuild --compilation_mode=opt\n"
|
||||
"to your user-wide ~/.bazelrc file. "
|
||||
"(Do not add this to the project-level .bazelrc file.)")
|
||||
logger.warning(msg)
|
||||
|
||||
|
||||
def main():
|
||||
check_optimized_build()
|
||||
|
||||
print("Tip: set TESTS_TO_RUN='pattern' to run a subset of benchmarks")
|
||||
ray.init()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user