From 66d327c6df32d48e33ba6f403ded3f3c21c288cb Mon Sep 17 00:00:00 2001 From: John Calderon Date: Mon, 3 Apr 2023 10:49:25 -0400 Subject: [PATCH 1/3] cli and output changed to deepview --- pyproject.toml | 6 +++--- skyline/commands/interactive.py | 2 +- skyline/db/database.py | 2 +- skyline/energy/measurer.py | 3 ++- skyline/error_printing.py | 2 +- skyline/initialization.py | 6 +++--- skyline/server.py | 4 ++-- skyline/skyline.py | 2 +- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 473cb21..1af18d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [tool.poetry] -name = "skyline-profiler" +name = "deepview-profiler" version = "0.12.1" description = "Interactive performance profiling and debugging tool for PyTorch neural networks." authors = ["Geoffrey Yu "] maintainers = ["Akbar Nurlybayev ", "Yubo Gao "] license = "Apache-2.0" readme = "README.md" -repository = "https://github.com/CentML/skyline" +repository = "https://github.com/CentML/DeepView.Profile" keywords = ["pytorch", "neural networks", "debugger", "profiler"] classifiers = [ "Development Status :: 4 - Beta", @@ -22,7 +22,7 @@ packages = [ include = [ "pyproject.toml" ] [tool.poetry.scripts] -skyline = "skyline.skyline:main" +deepview = "skyline.skyline:main" [tool.poetry.dependencies] python = "^3.7" diff --git a/skyline/commands/interactive.py b/skyline/commands/interactive.py index bea65bf..170bb04 100644 --- a/skyline/commands/interactive.py +++ b/skyline/commands/interactive.py @@ -63,7 +63,7 @@ def signal_handler(signal, frame): with SkylineServer(args.host, args.port) as server: _, port = server.listening_on logger.info( - "Skyline interactive profiling session started! " + "Deepview interactive profiling session started! " "Listening on port %d.", port, ) diff --git a/skyline/db/database.py b/skyline/db/database.py index 92dee31..9aa32c6 100644 --- a/skyline/db/database.py +++ b/skyline/db/database.py @@ -3,7 +3,7 @@ import sqlite3 BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -DB_PATH = os.path.join(BASE_DIR, "skyline.sqlite3") +DB_PATH = os.path.join(BASE_DIR, "deepview.sqlite3") class DatabaseInterface: diff --git a/skyline/energy/measurer.py b/skyline/energy/measurer.py index bff12e6..f52a2ff 100644 --- a/skyline/energy/measurer.py +++ b/skyline/energy/measurer.py @@ -20,7 +20,8 @@ def measurer_init(self): self.last_cpu = np.array(energy[0::2]) self.last_dram = np.array(energy[1::2]) except Exception as e: - print("Warning. Failed to get CPU energy") + print("Warning. Failed to get CPU energy. You need to set the right permissions for pyRAPL") + print("eg. $ sudo chmod -R a+r /sys/class/powercap/intel-rapl") def measurer_measure(self): # Get energy consumed so far (since last CPU reset) diff --git a/skyline/error_printing.py b/skyline/error_printing.py index 36ab8f4..d0f75e5 100644 --- a/skyline/error_printing.py +++ b/skyline/error_printing.py @@ -3,7 +3,7 @@ def print_analysis_error(error, file=sys.stderr): print( - "Skyline encountered an error when profiling your model:", + "Deepview encountered an error when profiling your model:", file=file, ) print("->", str(error), file=file) diff --git a/skyline/initialization.py b/skyline/initialization.py index fb84ec9..0e0444d 100644 --- a/skyline/initialization.py +++ b/skyline/initialization.py @@ -50,9 +50,9 @@ def _validate_dependencies(): return True except ImportError as ex: logger.error( - "Skyline could not find the '%s' module, which is a required " + "Deepview could not find the '%s' module, which is a required " "dependency. Please make sure all the required dependencies are " - "installed before launching Skyline. If you use a package " + "installed before launching Deepview. If you use a package " "manager, these dependencies will be automatically installed for " "you.", ex.name, @@ -64,7 +64,7 @@ def _validate_gpu(): import torch if not torch.cuda.is_available(): logger.error( - "Skyline did not detect a GPU on this machine. Skyline only " + "Deepview did not detect a GPU on this machine. Deepview only " "profiles deep learning workloads on GPUs." ) return False diff --git a/skyline/server.py b/skyline/server.py index d78d9f0..7300309 100644 --- a/skyline/server.py +++ b/skyline/server.py @@ -47,7 +47,7 @@ def __exit__(self, exc_type, exc_value, traceback): def start(self): self._analysis_request_manager.start() self._connection_acceptor.start() - logger.debug("Skyline server has started.") + logger.debug("Deepview server has started.") def stop(self): def shutdown(): @@ -57,7 +57,7 @@ def shutdown(): self._analysis_request_manager.stop() self._main_executor.submit(shutdown).result() self._main_executor.shutdown() - logger.debug("Skyline server has shut down.") + logger.debug("Deepview server has shut down.") @property def listening_on(self): diff --git a/skyline/skyline.py b/skyline/skyline.py index 35524a3..32b2353 100644 --- a/skyline/skyline.py +++ b/skyline/skyline.py @@ -27,7 +27,7 @@ def main(): args = parser.parse_args() if args.version: - print('Skyline Command Line Interface', 'v' + skyline.__version__,) + print('Deepview Command Line Interface', 'v' + skyline.__version__,) return if 'func' not in args: From 0ed611e6b2438adf751c04fd232e140e5cd46c6d Mon Sep 17 00:00:00 2001 From: John Calderon Date: Tue, 4 Apr 2023 09:21:03 -0400 Subject: [PATCH 2/3] changed reference to deepview --- README.md | 22 +++++++++++----------- docs/remote.md | 4 ++-- skyline/analysis/static.py | 2 +- skyline/commands/interactive.py | 2 +- skyline/commands/measurements.py | 4 ++-- skyline/commands/memory.py | 2 +- skyline/commands/prediction_models.py | 6 +++--- skyline/commands/time.py | 4 ++-- skyline/io/connection_acceptor.py | 6 +++--- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 763df65..8dc65b2 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ To run DeepView.Profile, you need: git clone https://github.com/CentML/DeepView.Profile cd skyline poetry install -poetry run skyline --help +poetry run deepview --help ``` ### Installation from PyPi @@ -44,19 +44,19 @@ poetry run skyline --help Installing with [Poetry](https://python-poetry.org/) ```zsh -poetry add skyline-profiler -poetry run skyline --help +poetry add deepview-profiler +poetry run deepview --help ``` Installing with [Pipenv](https://pipenv.pypa.io/en/latest/) ```zsh -pipenv install skyline-profiler -pipenv run skyline --help +pipenv install deepview-profiler +pipenv run deepview --help ``` Installing with [Pip](https://packaging.python.org/en/latest/tutorials/installing-packages/#use-pip-for-installing) ```zsh -python3 -m pip install skyline-profiler +python3 -m pip install deepview-profiler python3 skyline ``` @@ -68,26 +68,26 @@ Once your entry point file is ready, there are two ways to profile interactive p ### Interactive Profiling ```zsh -poetry run skyline interactive +poetry run deepview interactive ``` ### Standalone Profiling Standalone profiling is useful when you just want access to DeepView.Profile's profiling functionality. DeepView.Profile will save the profiling results (called a "report") into a [SQLite database file](https://www.sqlite.org/) that you can then query yourself. We describe the database schema for DeepView.Profile's run time and memory reports in the [Run Time Report Format](docs/run-time-report.md) and [Memory Report Format](docs/memory-report.md) pages respectively. -To have DeepView.Profile perform run time profiling, you use the `skyline time` +To have DeepView.Profile perform run time profiling, you use the `deepview time` subcommand. In addition to the entry point file, you also need to specify the file where you want DeepView.Profile to save the run time profiling report using the `--output` or `-o` flag. ```zsh -poetry run skyline time entry_point.py --output my_output_file.sqlite +poetry run deepview time entry_point.py --output my_output_file.sqlite ``` Launching memory profiling is almost the same as launching run time profiling. -You just need to use `skyline memory` instead of `skyline time`. +You just need to use `deepview memory` instead of `skyline time`. ```zsh -poetry run skyline memory entry_point.py --output my_output_file.sqlite +poetry run deepview memory entry_point.py --output my_output_file.sqlite ```

Development Environment Setup

diff --git a/docs/remote.md b/docs/remote.md index 66c4422..966ebe5 100644 --- a/docs/remote.md +++ b/docs/remote.md @@ -28,13 +28,13 @@ To install the DeepView.Explore plugin on the server, take the following steps. DeepView.Profile needs to running on the server to enable the plugin. You can connect to the server via SSH and start DeepView.Profile by running the `skyline interactive` command as usual. ```zsh -poetry run skyline interactive +poetry run deepview interactive ``` If you want to use a different port, you can use the `--port` flag to tell the profiler to listen on a different port. ```zsh -poetry run skyline interactive --port portNumber +poetry run deepview interactive --port portNumber ``` ### Starting DeepView.Explore diff --git a/skyline/analysis/static.py b/skyline/analysis/static.py index 21644ab..316f7ad 100644 --- a/skyline/analysis/static.py +++ b/skyline/analysis/static.py @@ -39,6 +39,6 @@ def visit_FunctionDef(self, node): if self.function_node is not None: # Return early if we've already found the provider return - if node.name != 'skyline_input_provider': + if node.name != 'deepview_input_provider': return self.function_node = node diff --git a/skyline/commands/interactive.py b/skyline/commands/interactive.py index 170bb04..b0d47de 100644 --- a/skyline/commands/interactive.py +++ b/skyline/commands/interactive.py @@ -14,7 +14,7 @@ def register_command(subparsers): parser = subparsers.add_parser( "interactive", - help="Start a new Skyline interactive profiling session.", + help="Start a new Deepview interactive profiling session.", ) parser.add_argument( "--host", diff --git a/skyline/commands/measurements.py b/skyline/commands/measurements.py index a8a6860..7d27bca 100644 --- a/skyline/commands/measurements.py +++ b/skyline/commands/measurements.py @@ -19,7 +19,7 @@ def register_command(subparsers): ) parser.add_argument( "entry_point", - help="The entry point file in this project that contains the Skyline " + help="The entry point file in this project that contains the Deepview " "provider functions.", ) parser.add_argument( @@ -79,7 +79,7 @@ def actual_main(args): 'samples_per_second', 'memory_usage_bytes', ]) - project_root = os.cwd() + project_root = os.getcwd() for batch_size in args.batch_sizes: for trial in range(args.trials): session = AnalysisSession.new_from( diff --git a/skyline/commands/memory.py b/skyline/commands/memory.py index c21f394..d92762b 100644 --- a/skyline/commands/memory.py +++ b/skyline/commands/memory.py @@ -48,7 +48,7 @@ def actual_main(args): sys.exit(1) try: - project_root = os.cwd() + project_root = os.getcwd() session = AnalysisSession.new_from( project_root, args.entry_point) session.generate_memory_usage_report( diff --git a/skyline/commands/prediction_models.py b/skyline/commands/prediction_models.py index 81773c7..75a0b42 100644 --- a/skyline/commands/prediction_models.py +++ b/skyline/commands/prediction_models.py @@ -15,11 +15,11 @@ def register_command(subparsers): parser = subparsers.add_parser( "prediction-models", - help="Evaluate Skyline's prediction accuracy.", + help="Evaluate Deepview's prediction accuracy.", ) parser.add_argument( "entry_point", - help="The entry point file in this project that contains the Skyline " + help="The entry point file in this project that contains the Deepview " "provider functions.", ) parser.add_argument( @@ -75,7 +75,7 @@ def actual_main(args): 'memory_usage_bytes_slope', 'memory_usage_bytes_bias', ]) - project_root = os.cwd() + project_root = os.getcwd() for batch_size in args.batch_sizes: session = AnalysisSession.new_from( project_root, args.entry_point) diff --git a/skyline/commands/time.py b/skyline/commands/time.py index 1b19c7a..351ec40 100644 --- a/skyline/commands/time.py +++ b/skyline/commands/time.py @@ -18,7 +18,7 @@ def register_command(subparsers): ) parser.add_argument( "entry_point", - help="The entry point file in this project that contains the Skyline " + help="The entry point file in this project that contains the Deepview " "provider functions.", ) parser.add_argument( @@ -49,7 +49,7 @@ def actual_main(args): sys.exit(1) try: - project_root = os.cwd() + project_root = os.getcwd() session = AnalysisSession.new_from( project_root, args.entry_point) session.generate_run_time_breakdown_report( diff --git a/skyline/io/connection_acceptor.py b/skyline/io/connection_acceptor.py index 6c21897..cefc42c 100644 --- a/skyline/io/connection_acceptor.py +++ b/skyline/io/connection_acceptor.py @@ -40,7 +40,7 @@ def start(self): self._sentinel.start() self._acceptor.start() logger.debug( - "Skyline is listening for connections on (%s:%d).", + "Deepview is listening for connections on (%s:%d).", self._host, self._port, ) @@ -51,7 +51,7 @@ def stop(self): self._server_socket.close() self._sentinel.stop() logging.debug( - "Skyline has stopped listening for connections on (%s:%d).", + "Deepview has stopped listening for connections on (%s:%d).", self._host, self._port, ) @@ -80,4 +80,4 @@ def _accept_connections(self): self._handler_function(socket, address) except: logging.exception( - "Skyline has unexpectedly stopped accepting connections.") + "Deepview has unexpectedly stopped accepting connections.") From 1a7df54ee23c75f06b8f79a6a6094fa064f84b0c Mon Sep 17 00:00:00 2001 From: John Calderon Date: Tue, 4 Apr 2023 15:32:20 -0400 Subject: [PATCH 3/3] renamed commands and print to deepview --- README.md | 4 ++-- docs/remote.md | 6 +++--- skyline/analysis/request_manager.py | 4 ++-- skyline/analysis/runner.py | 2 +- skyline/analysis/session.py | 14 +++++++------- skyline/server.py | 3 ++- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 8dc65b2..b8710e2 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ To run DeepView.Profile, you need: ### Installation from source ```bash git clone https://github.com/CentML/DeepView.Profile -cd skyline +cd DeepView.Profile poetry install poetry run deepview --help ``` @@ -84,7 +84,7 @@ poetry run deepview time entry_point.py --output my_output_file.sqlite ``` Launching memory profiling is almost the same as launching run time profiling. -You just need to use `deepview memory` instead of `skyline time`. +You just need to use `deepview memory` instead of `deepview time`. ```zsh poetry run deepview memory entry_point.py --output my_output_file.sqlite diff --git a/docs/remote.md b/docs/remote.md index 966ebe5..21cca88 100644 --- a/docs/remote.md +++ b/docs/remote.md @@ -24,8 +24,8 @@ To install the DeepView.Explore plugin on the server, take the following steps. ## Starting a Remote Profiling Session -### Starting the Skyline Profiler -DeepView.Profile needs to running on the server to enable the plugin. You can connect to the server via SSH and start DeepView.Profile by running the `skyline interactive` command as usual. +### Starting the DeepView.Profiler +DeepView.Profile needs to running on the server to enable the plugin. You can connect to the server via SSH and start DeepView.Profile by running the `deepview interactive` command as usual. ```zsh poetry run deepview interactive @@ -38,4 +38,4 @@ poetry run deepview interactive --port portNumber ``` ### Starting DeepView.Explore -Launch VSCode and open DeepView.Explore by running the Skyline command in the command palette (Ctrl-Shift-P on Linux/Windows, ⌘-Shift-P on macOS). Select your project root and begin profiling. +Launch VSCode and open DeepView.Explore by running the deepview command in the command palette (Ctrl-Shift-P on Linux/Windows, ⌘-Shift-P on macOS). Select your project root and begin profiling. diff --git a/skyline/analysis/request_manager.py b/skyline/analysis/request_manager.py index a20d3a2..1b6c624 100644 --- a/skyline/analysis/request_manager.py +++ b/skyline/analysis/request_manager.py @@ -142,7 +142,7 @@ def _handle_analysis_request(self, analysis_request, context): self._send_analysis_error, AnalysisError( 'An unexpected error occurred when analyzing your model. ' - 'Please file a bug report and then restart Skyline.' + 'Please file a bug report and then restart Deepview.' ), context, ) @@ -190,7 +190,7 @@ def _send_habitat_response(self, habitat_resp, context): self._message_sender.send_habitat_response(habitat_resp, context) except: logger.exception( - 'Exception occurred when sending a habitat response.') + 'Exception occurred when sending a DeepView.Predict response.') def _send_energy_response(self, energy_resp, context): # Called from the main executor. Do not call directly! diff --git a/skyline/analysis/runner.py b/skyline/analysis/runner.py index 15022be..54f2760 100644 --- a/skyline/analysis/runner.py +++ b/skyline/analysis/runner.py @@ -15,7 +15,7 @@ def analyze_project(project_root, entry_point, nvml): yield session.measure_throughput() torch.cuda.empty_cache() - print("analyze_project: running habitat_predict()") + print("analyze_project: running deepview_predict()") yield session.habitat_predict() torch.cuda.empty_cache() diff --git a/skyline/analysis/session.py b/skyline/analysis/session.py index 8b92008..cbe1d5a 100644 --- a/skyline/analysis/session.py +++ b/skyline/analysis/session.py @@ -31,7 +31,7 @@ habitat_found = True except ImportError: - logger.debug("Habitat not found, GPU predictions not available") + logger.debug("Deepview.Predict not found, GPU predictions not available") habitat_found = False @@ -211,10 +211,10 @@ def habitat_compute_threshold(self, runnable, context): def habitat_predict(self): resp = pm.HabitatResponse() if not habitat_found: - logger.debug("Skipping Habitat predictions, returning empty response.") + logger.debug("Skipping deepview predictions, returning empty response.") return resp - print("habitat_predict: begin") + print("deepview_predict: begin") DEVICES = [ habitat.Device.P100, habitat.Device.P4000, @@ -244,14 +244,14 @@ def habitat_predict(self): source_device = device pynvml.nvmlShutdown() if not source_device: - logger.debug("Skipping Habitat predictions, source not in list of supported GPUs.") + logger.debug("Skipping Deepview predictions, source not in list of supported GPUs.") src = pm.HabitatDevicePrediction() src.device_name = 'unavailable' src.runtime_ms = -1 resp.predictions.append(src) return resp - print("habitat_predict: detected source device", source_device.name) + print("deepview_predict: detected source device", source_device.name) # get model model = self._model_provider() @@ -284,7 +284,7 @@ def runnable(): with tracker.track(): iteration(*inputs) - print("habitat_predict: tracing on origin device") + print("deepview_predict: tracing on origin device") trace = tracker.get_tracked_trace() src = pm.HabitatDevicePrediction() @@ -293,7 +293,7 @@ def runnable(): resp.predictions.append(src) for device in DEVICES: - print("habitat_predict: predicting for", device) + print("deepview_predict: predicting for", device) predicted_trace = trace.to_device(device) pred = pm.HabitatDevicePrediction() diff --git a/skyline/server.py b/skyline/server.py index 7300309..0fd4068 100644 --- a/skyline/server.py +++ b/skyline/server.py @@ -90,7 +90,8 @@ def _on_connection_closed(self, address): def _submit_work(self, func, *args, **kwargs): print("submit_work", func) - print("submit_work args:", args) + #print("submit_work args:", args) + logger.debug("submit_work args:", args) print("submit_work kwargs:", kwargs) # Do not call directly - called by another thread to submit work # onto the main executor