MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / fillTensorWithValue

Function fillTensorWithValue

tests/unittests/fp8_gemm_test/worker.cpp:109–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107
108template<typename T>
109bool fillTensorWithValue(void* devPtr, const size_t sizeBytes, const T value)
110{
111 std::vector<T> hData(sizeBytes / sizeof(T), value);
112 const auto status =
113 cudaMemcpy(static_cast<uint8_t*>(devPtr), hData.data(), hData.size() * sizeof(T), cudaMemcpyHostToDevice);
114 if (status != cudaSuccess) {
115 return false;
116 }
117 return true;
118};
119
120//------------------------------------------------
121

Callers

nothing calls this directly

Calls 2

dataMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected