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

Function printDevPtr

examples/cpp/xlnet/xlnet_correctness_example.cc:41–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39/*************** NPZ related operations *****************/
40template<typename T>
41void printDevPtr(const T* d_cache, int len, char* name, bool print)
42{
43 T* res = (T*)malloc(sizeof(T) * len);
44 cudaMemcpy(res, d_cache, sizeof(T) * len, cudaMemcpyDeviceToHost);
45
46 printf("%s ", name);
47 int j = 0;
48 for (int i = 0; i < len; i++) {
49 if (res[i]) {
50 printf("%f ", (float)res[i]);
51 if (j % 20 == 19) {
52 printf("\n");
53 }
54 }
55 j = j + 1;
56 }
57 free(res);
58 printf("\n");
59}
60
61template<typename T>
62float castToFloat(T input)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected