diff --git a/gen/nvml/const_gen.go b/gen/nvml/const_gen.go new file mode 100644 index 0000000..36a66f6 --- /dev/null +++ b/gen/nvml/const_gen.go @@ -0,0 +1,19 @@ +// Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package nvml + +const ( + SYSTEM_PROCESS_NAME_BUFFER_SIZE = 256 +) diff --git a/gen/nvml/system.go b/gen/nvml/system.go index 55f6aaa..424f99b 100644 --- a/gen/nvml/system.go +++ b/gen/nvml/system.go @@ -14,9 +14,6 @@ package nvml -// #include -import "C" - // nvml.SystemGetDriverVersion() func SystemGetDriverVersion() (string, Return) { Version := make([]byte, SYSTEM_DRIVER_VERSION_BUFFER_SIZE) @@ -47,8 +44,8 @@ func SystemGetCudaDriverVersion_v2() (int, Return) { // nvml.SystemGetProcessName() func SystemGetProcessName(Pid int) (string, Return) { - Name := make([]byte, C.PR_SET_NAME) - ret := nvmlSystemGetProcessName(uint32(Pid), &Name[0], C.PR_SET_NAME) + Name := make([]byte, SYSTEM_PROCESS_NAME_BUFFER_SIZE) + ret := nvmlSystemGetProcessName(uint32(Pid), &Name[0], SYSTEM_PROCESS_NAME_BUFFER_SIZE) return string(Name[:clen(Name)]), ret }