fetch_ml/internal/worker/native_bridge.go
Jeremie Fraeys be39b37aec
feat: native GPU detection and NVML bridge for macOS and Linux
- Add dynamic NVML loading for Linux GPU detection
- Add macOS GPU detection via IOKit framework
- Add Zig NVML wrapper for cross-platform GPU queries
- Update native bridge to support platform-specific GPU libs
- Add CMake support for NVML dynamic library
2026-02-21 17:59:59 -05:00

57 lines
1.7 KiB
Go

//go:build cgo && !native_libs
// +build cgo,!native_libs
package worker
import (
"errors"
"log"
"github.com/jfraeys/fetch_ml/internal/manifest"
"github.com/jfraeys/fetch_ml/internal/queue"
)
func init() {
log.Printf("[native] Native libraries disabled (build with -tags native_libs to enable)")
}
// HashFilesBatchNative is not available without native_libs build tag.
func HashFilesBatchNative(paths []string) ([]string, error) {
return nil, errors.New("native batch hash requires native_libs build tag")
}
// GetSIMDImplName returns "disabled" when native libs aren't built.
func GetSIMDImplName() string {
return "disabled"
}
// HasSIMDSHA256 returns false when native libs aren't built.
func HasSIMDSHA256() bool {
return false
}
// ScanArtifactsNative is disabled without native_libs build tag.
func ScanArtifactsNative(runDir string) (*manifest.Artifacts, error) {
return nil, errors.New("native artifact scanner requires native_libs build tag")
}
// ExtractTarGzNative is disabled without native_libs build tag.
func ExtractTarGzNative(archivePath, dstDir string) error {
return errors.New("native tar.gz extractor requires native_libs build tag")
}
// QueueIndexNative is a stub type when native libs aren't built.
type QueueIndexNative struct{}
// OpenQueueIndexNative is not available without native_libs build tag.
func OpenQueueIndexNative(queueDir string) (*QueueIndexNative, error) {
return nil, errors.New("native queue index requires native_libs build tag")
}
// Close is a no-op for the stub.
func (qi *QueueIndexNative) Close() {}
// AddTasks is not available without native_libs build tag.
func (qi *QueueIndexNative) AddTasks(tasks []*queue.Task) error {
return errors.New("native queue index requires native_libs build tag")
}