MCPcopy Create free account
hub / github.com/KnowingNothing/MatmulTutorial / get_sm_count

Function get_sm_count

include/common.h:43–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41#define DEVICE __forceinline__ __device__
42
43int get_sm_count() {
44 int device_id;
45 cudaError_t result = cudaGetDevice(&device_id);
46 if (result != cudaSuccess) {
47 std::cerr << "cudaGetDevice() returned error " << cudaGetErrorString(result)
48 << std::endl;
49 return 1;
50 }
51 int multiprocessor_count;
52 result = cudaDeviceGetAttribute(&multiprocessor_count,
53 cudaDevAttrMultiProcessorCount, device_id);
54 if (result != cudaSuccess) {
55 std::cerr << "cudaDeviceGetAttribute() returned error "
56 << cudaGetErrorString(result) << std::endl;
57 return 1;
58 }
59 return multiprocessor_count;
60}
61
62static constexpr int MAX_CLUSTER_SIZE = 16;
63static constexpr int WARP_GROUP_SIZE = 128;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected