mirror of
https://github.com/andreinechaev/nvcc4jupyter.git
synced 2026-06-13 18:50:47 +05:30
Move source files to nvcc4jupyter directory
This commit is contained in:
@@ -0,0 +1 @@
|
||||
__version__ = "1.0.0"
|
||||
@@ -106,7 +106,3 @@ def get_parser_cuda_group_delete() -> argparse.ArgumentParser:
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
def print_out(out: str):
|
||||
for l in out.split("\n"):
|
||||
print(l)
|
||||
@@ -10,22 +10,27 @@ from typing import List, Optional
|
||||
from IPython.core.interactiveshell import InteractiveShell
|
||||
from IPython.core.magic import Magics, cell_magic, line_magic, magics_class
|
||||
|
||||
from common import helper
|
||||
from . import parsers
|
||||
|
||||
DEFAULT_EXEC_FNAME = "cuda_exec.out"
|
||||
SHARED_GROUP_NAME = "shared"
|
||||
|
||||
|
||||
def print_out(out: str):
|
||||
for l in out.split("\n"):
|
||||
print(l)
|
||||
|
||||
|
||||
@magics_class
|
||||
class NVCCPlugin(Magics):
|
||||
def __init__(self, shell: InteractiveShell):
|
||||
super(NVCCPlugin, self).__init__(shell)
|
||||
self.shell: InteractiveShell # type hint not provided by parent class
|
||||
|
||||
self.parser_cuda = helper.get_parser_cuda()
|
||||
self.parser_cuda_group_save = helper.get_parser_cuda_group_save()
|
||||
self.parser_cuda_group_delete = helper.get_parser_cuda_group_delete()
|
||||
self.parser_cuda_group_run = helper.get_parser_cuda_group_run()
|
||||
self.parser_cuda = parsers.get_parser_cuda()
|
||||
self.parser_cuda_group_save = parsers.get_parser_cuda_group_save()
|
||||
self.parser_cuda_group_delete = parsers.get_parser_cuda_group_delete()
|
||||
self.parser_cuda_group_run = parsers.get_parser_cuda_group_run()
|
||||
|
||||
self.workdir = tempfile.mkdtemp()
|
||||
print(f'Source files will be saved in "{self.workdir}".')
|
||||
@@ -241,7 +246,7 @@ class NVCCPlugin(Magics):
|
||||
)
|
||||
|
||||
output = self._compile_and_run(group_name, args)
|
||||
helper.print_out(output)
|
||||
print_out(output)
|
||||
|
||||
@cell_magic
|
||||
def cuda_group_save(self, line: str, cell: str) -> None:
|
||||
@@ -280,7 +285,7 @@ class NVCCPlugin(Magics):
|
||||
return
|
||||
|
||||
output = self._compile_and_run(args.group, args)
|
||||
helper.print_out(output)
|
||||
print_out(output)
|
||||
|
||||
@line_magic
|
||||
def cuda_group_delete(self, line: str) -> None:
|
||||
Reference in New Issue
Block a user