Skip to content

Commit

Permalink
Merge pull request #4 from seasonjs/patch-1
Browse files Browse the repository at this point in the history
fix gpu error with darwin
  • Loading branch information
Cyberhan123 authored Oct 23, 2023
2 parents b7746e1 + 2881930 commit 706caa6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions embed_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ var libRwkvArm []byte
var libName = "librwkv-*.dylib"

func getDl(gpu bool) []byte {
if gpu {
_, _ = GetGPUInfo()
}
if runtime.GOARCH == "amd64" {
return libRwkvAmd64
}
Expand Down
4 changes: 2 additions & 2 deletions embed_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ var supportGpuTable = map[string][]byte{

func getDl(gpu bool) []byte {
if gpu {
gpu, err := GetGPUInfo()
gpuInfo, err := GetGPUInfo()
if err != nil {
log.Println(err)
}
if supportGpuTable[gpu] != nil {
if supportGpuTable[gpuInfo] != nil {
return supportGpuTable[gpu]
} else {
log.Println("GPU not support, use CPU instead.")
Expand Down
2 changes: 2 additions & 0 deletions gpu_darwin.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) seasonjs. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

//go:build darwin

package rwkv

func GetGPUInfo() (string, error) {
Expand Down
2 changes: 2 additions & 0 deletions gpu_linux.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) seasonjs. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

//go:build linux

package rwkv

func GetGPUInfo() (string, error) {
Expand Down

0 comments on commit 706caa6

Please sign in to comment.