MCPcopy
hub / github.com/dmlc/dgl / _format_partition

Function _format_partition

python/dgl/distributed/dist_graph.py:457–478  ·  view source on GitHub ↗

Format the partition to the specified format.

(graph, graph_format)

Source from the content-addressed store, hash-verified

455
456
457def _format_partition(graph, graph_format):
458 """Format the partition to the specified format."""
459 if isinstance(graph, gb.FusedCSCSamplingGraph):
460 return graph
461 # formatting dtype
462 # TODO(Rui) Formatting forcely is not a perfect solution.
463 # We'd better store all dtypes when mapping to shared memory
464 # and map back with original dtypes.
465 for k, dtype in RESERVED_FIELD_DTYPE.items():
466 if k in graph.ndata:
467 graph.ndata[k] = F.astype(graph.ndata[k], dtype)
468 if k in graph.edata:
469 graph.edata[k] = F.astype(graph.edata[k], dtype)
470 # Create the graph formats specified the users.
471 print(
472 "Start to create specified graph formats which may take "
473 "non-trivial time."
474 )
475 graph = graph.formats(graph_format)
476 graph.create_formats_()
477 print(f"Finished creating specified graph formats: {graph_format}")
478 return graph
479
480
481class DistGraphServer(KVServer):

Callers 1

__init__Method · 0.85

Calls 4

itemsMethod · 0.45
astypeMethod · 0.45
formatsMethod · 0.45
create_formats_Method · 0.45

Tested by

no test coverage detected