Loading CHANGELOG.md +5 −0 Original line number Diff line number Diff line # Change log of GraphDot ## 0.8a7 (2021-01-02) - Gradient evaluation for the MaxiMin graph metric. - Gradient evaluation for Gaussian field regressor prediction loss. ## 0.8a6 (2020-12-29) - Optimized the evaluation of the gradient of the loss function for the Loading LICENSE +1 −1 Original line number Diff line number Diff line GraphDot Copyright (c) 2019-2020, The Regents of the University of California, GraphDot Copyright (c) 2019-2021, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved. Loading graphdot/__init__.py +2 −2 Original line number Diff line number Diff line Loading @@ -5,14 +5,14 @@ from .graph import Graph __all__ = ['Graph'] __version__ = '0.8a6' __version__ = '0.8a7' __author__ = '''Yu-Hang "Maxin" Tang, Oguz Selvitopi, Chi-Feng Wang, Thomas H. Li''' __maintainer__ = 'Yu-Hang "Maxin" Tang' __email__ = 'Tang.Maxin@gmail.com' __license__ = 'see LICENSE file' __copyright__ = ''' GraphDot Copyright (c) 2019-2020, The Regents of the University of California, GraphDot Copyright (c) 2019-2021, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved. Loading graphdot/codegen/sympy_printer.py +1 −1 Original line number Diff line number Diff line #!/usr/bin/env python # -*- coding: utf-8 -*- from sympy.codegen import ast from sympy.printing.cxxcode import CXX11CodePrinter from sympy.printing.cxx import CXX11CodePrinter class CUDACXX11CodePrinter(CXX11CodePrinter): Loading graphdot/kernel/marginalized/_backend_cuda.py +22 −13 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ class CUDABackend(Backend): self.ctx = kwargs.pop('cuda_context', graphdot.cuda.defctx) self.device = self.ctx.get_device() self.scratch_pcg = None self.scratch_pcg_d = None self.block_per_sm = kwargs.pop('block_per_sm', 8) self.block_size = kwargs.pop('block_size', 128) Loading @@ -74,7 +75,22 @@ class CUDABackend(Backend): 'try to normalize automatically with `Graph.normalize_types`.' ) def _allocate_pcg_scratch(self, number, max_graph_size, traits): def _allocate_scratch(self, scratch, scratch_d, number, length, n_temporaries): if (scratch is None or len(scratch) < number or scratch[0].nmax < length or scratch[0].ndim < n_temporaries): self.ctx.synchronize() scratch = [ PCGScratch(length, n_temporaries) for _ in range(number) ] scratch_d = umarray( np.array([s.state for s in scratch], PCGScratch.dtype) ) self.ctx.synchronize() return scratch, scratch_d def allocate_pcg_scratch(self, number, max_graph_size, traits): if traits.eval_gradient is True: if traits.nodal in [True, 'block']: length = max_graph_size**2 Loading @@ -86,17 +102,10 @@ class CUDABackend(Backend): length = max_graph_size**2 n_temporaries = 5 if (self.scratch_pcg is None or len(self.scratch_pcg) < number or self.scratch_pcg[0].nmax < length or self.scratch_pcg[0].ndim < n_temporaries): self.ctx.synchronize() self.scratch_pcg = [ PCGScratch(length, n_temporaries) for _ in range(number) ] self.scratch_pcg_d = umarray( np.array([s.state for s in self.scratch_pcg], PCGScratch.dtype) self.scratch_pcg, self.scratch_pcg_d = self._allocate_scratch( self.scratch_pcg, self.scratch_pcg_d, number, length, n_temporaries ) self.ctx.synchronize() return self.scratch_pcg_d def _register_graph(self, graph): Loading Loading @@ -301,7 +310,7 @@ class CUDABackend(Backend): ''' allocate scratch buffers ''' max_graph_size = np.max([len(g.nodes) for g in graphs]) scratch_pcg = self._allocate_pcg_scratch( scratch_pcg = self.allocate_pcg_scratch( launch_block_count, max_graph_size, traits ) Loading Loading
CHANGELOG.md +5 −0 Original line number Diff line number Diff line # Change log of GraphDot ## 0.8a7 (2021-01-02) - Gradient evaluation for the MaxiMin graph metric. - Gradient evaluation for Gaussian field regressor prediction loss. ## 0.8a6 (2020-12-29) - Optimized the evaluation of the gradient of the loss function for the Loading
LICENSE +1 −1 Original line number Diff line number Diff line GraphDot Copyright (c) 2019-2020, The Regents of the University of California, GraphDot Copyright (c) 2019-2021, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved. Loading
graphdot/__init__.py +2 −2 Original line number Diff line number Diff line Loading @@ -5,14 +5,14 @@ from .graph import Graph __all__ = ['Graph'] __version__ = '0.8a6' __version__ = '0.8a7' __author__ = '''Yu-Hang "Maxin" Tang, Oguz Selvitopi, Chi-Feng Wang, Thomas H. Li''' __maintainer__ = 'Yu-Hang "Maxin" Tang' __email__ = 'Tang.Maxin@gmail.com' __license__ = 'see LICENSE file' __copyright__ = ''' GraphDot Copyright (c) 2019-2020, The Regents of the University of California, GraphDot Copyright (c) 2019-2021, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved. Loading
graphdot/codegen/sympy_printer.py +1 −1 Original line number Diff line number Diff line #!/usr/bin/env python # -*- coding: utf-8 -*- from sympy.codegen import ast from sympy.printing.cxxcode import CXX11CodePrinter from sympy.printing.cxx import CXX11CodePrinter class CUDACXX11CodePrinter(CXX11CodePrinter): Loading
graphdot/kernel/marginalized/_backend_cuda.py +22 −13 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ class CUDABackend(Backend): self.ctx = kwargs.pop('cuda_context', graphdot.cuda.defctx) self.device = self.ctx.get_device() self.scratch_pcg = None self.scratch_pcg_d = None self.block_per_sm = kwargs.pop('block_per_sm', 8) self.block_size = kwargs.pop('block_size', 128) Loading @@ -74,7 +75,22 @@ class CUDABackend(Backend): 'try to normalize automatically with `Graph.normalize_types`.' ) def _allocate_pcg_scratch(self, number, max_graph_size, traits): def _allocate_scratch(self, scratch, scratch_d, number, length, n_temporaries): if (scratch is None or len(scratch) < number or scratch[0].nmax < length or scratch[0].ndim < n_temporaries): self.ctx.synchronize() scratch = [ PCGScratch(length, n_temporaries) for _ in range(number) ] scratch_d = umarray( np.array([s.state for s in scratch], PCGScratch.dtype) ) self.ctx.synchronize() return scratch, scratch_d def allocate_pcg_scratch(self, number, max_graph_size, traits): if traits.eval_gradient is True: if traits.nodal in [True, 'block']: length = max_graph_size**2 Loading @@ -86,17 +102,10 @@ class CUDABackend(Backend): length = max_graph_size**2 n_temporaries = 5 if (self.scratch_pcg is None or len(self.scratch_pcg) < number or self.scratch_pcg[0].nmax < length or self.scratch_pcg[0].ndim < n_temporaries): self.ctx.synchronize() self.scratch_pcg = [ PCGScratch(length, n_temporaries) for _ in range(number) ] self.scratch_pcg_d = umarray( np.array([s.state for s in self.scratch_pcg], PCGScratch.dtype) self.scratch_pcg, self.scratch_pcg_d = self._allocate_scratch( self.scratch_pcg, self.scratch_pcg_d, number, length, n_temporaries ) self.ctx.synchronize() return self.scratch_pcg_d def _register_graph(self, graph): Loading Loading @@ -301,7 +310,7 @@ class CUDABackend(Backend): ''' allocate scratch buffers ''' max_graph_size = np.max([len(g.nodes) for g in graphs]) scratch_pcg = self._allocate_pcg_scratch( scratch_pcg = self.allocate_pcg_scratch( launch_block_count, max_graph_size, traits ) Loading