Skip to content

Commit

Permalink
Rename cli command (#44)
Browse files Browse the repository at this point in the history
* cli and output changed to deepview

* changed reference to deepview

* renamed commands and print to deepview
  • Loading branch information
johncalesp authored Apr 4, 2023
1 parent 0d3aa68 commit e9e46cc
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 54 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ 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 skyline --help
poetry run deepview --help
```

### Installation from PyPi
Expand All @@ -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
```

Expand All @@ -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 `deepview 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
```

<h2 id="dev-setup">Development Environment Setup</h2>
Expand Down
10 changes: 5 additions & 5 deletions docs/remote.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ 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 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
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.
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <gxyu@cs.toronto.edu>"]
maintainers = ["Akbar Nurlybayev <akbar@centml.ai>", "Yubo Gao <ybgao@centml.ai>"]
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",
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions skyline/analysis/request_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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!
Expand Down
2 changes: 1 addition & 1 deletion skyline/analysis/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
14 changes: 7 additions & 7 deletions skyline/analysis/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion skyline/analysis/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions skyline/commands/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
)
Expand Down
4 changes: 2 additions & 2 deletions skyline/commands/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion skyline/commands/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions skyline/commands/prediction_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions skyline/commands/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion skyline/db/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion skyline/energy/measurer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion skyline/error_printing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions skyline/initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions skyline/io/connection_acceptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down Expand Up @@ -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.")
7 changes: 4 additions & 3 deletions skyline/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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):
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit e9e46cc

Please sign in to comment.