MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / callCreateTpuVMTopology

Function callCreateTpuVMTopology

tpu/createTopologyVM.js:65–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63 const topology = '2x2';
64
65 async function callCreateTpuVMTopology() {
66 // Create a node
67 const node = new Node({
68 name: nodeName,
69 zone,
70 // acceleratorType: tpuType,
71 runtimeVersion: tpuSoftwareVersion,
72 // Define network
73 networkConfig: new NetworkConfig({
74 enableExternalIps: true,
75 network: `projects/${projectId}/global/networks/${networkName}`,
76 subnetwork: `projects/${projectId}/regions/${region}/subnetworks/${networkName}`,
77 }),
78 acceleratorConfig: new AcceleratorConfig({
79 type: tpuVersion,
80 topology,
81 }),
82 });
83
84 const parent = `projects/${projectId}/locations/${zone}`;
85 const request = {parent, node, nodeId: nodeName};
86
87 const [operation] = await tpuClient.createNode(request);
88
89 // Wait for the create operation to complete.
90 const [response] = await operation.promise();
91
92 console.log(JSON.stringify(response));
93 return response;
94 }
95 return await callCreateTpuVMTopology();
96 // [END tpu_vm_create_topology]
97}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected