MCPcopy Create free account
hub / github.com/KomputeProject/kompute / TEST

Function TEST

test/TestOpTensorCopy.cpp:10–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include "shaders/Utils.hpp"
9
10TEST(TestOpTensorCopy, CopyDeviceToDeviceTensor)
11{
12
13 kp::Manager mgr;
14
15 std::vector<float> testVecA{ 1, 2, 3 };
16 std::vector<float> testVecB{ 0, 0, 0 };
17
18 std::shared_ptr<kp::TensorT<float>> tensorA = mgr.tensor(testVecA);
19 std::shared_ptr<kp::TensorT<float>> tensorB = mgr.tensor(testVecB);
20
21 EXPECT_TRUE(tensorA->isInit());
22 EXPECT_TRUE(tensorB->isInit());
23
24 mgr.sequence()
25 ->eval<kp::OpTensorSyncDevice>({ tensorA, tensorB })
26 ->eval<kp::OpTensorCopy>({ tensorA, tensorB })
27 ->eval<kp::OpTensorSyncLocal>({ tensorA, tensorB });
28
29 // Making sure the GPU holds the same vector
30 EXPECT_EQ(tensorA->vector(), tensorB->vector());
31}
32
33TEST(TestOpTensorCopy, CopyDeviceToDeviceTensorMulti)
34{

Callers

nothing calls this directly

Calls 6

tensorMethod · 0.80
sequenceMethod · 0.80
algorithmMethod · 0.80
compileSourceFunction · 0.50
isInitMethod · 0.45
vectorMethod · 0.45

Tested by

no test coverage detected