Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinicore
Commits
4ffb2f73
Commit
4ffb2f73
authored
Apr 01, 2025
by
PanZezhong
Browse files
issue/134 添加一键安装脚本
parent
65df17f7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
121 additions
and
13 deletions
+121
-13
README.md
README.md
+23
-1
include/infinicore.h
include/infinicore.h
+4
-4
scripts/install.bat
scripts/install.bat
+48
-0
scripts/install.sh
scripts/install.sh
+36
-0
src/utils.h
src/utils.h
+6
-6
xmake/test.lua
xmake/test.lua
+4
-2
No files found.
README.md
View file @
4ffb2f73
...
...
@@ -15,6 +15,22 @@ InfiniCore 是一个跨平台统一编程工具集,为不同芯片平台的功
## 配置和使用
### 一键安装
在
`script/`
目录中分别提供了
`install.bat`
windows安装脚本和
`install.sh`
linux安装脚本。使用方式如下:
```
shell
cd
InfiniCore
# Windows
.
\s
cripts
\i
nstall.bat
.
--nv-gpu
=
true
# Linux
source
./scripts/install.sh
.
--nv-gpu
=
true
```
### 手动安装
1.
项目配置
-
查看当前配置
...
...
@@ -55,12 +71,18 @@ InfiniCore 是一个跨平台统一编程工具集,为不同芯片平台的功
按输出提示设置
`INFINI_ROOT`
和
`LD_LIBRARY_PATH`
环境变量。
4.
运行算子测试
### 运行测试
#### 运行Python算子测试
```
shell
python
test
/infiniop/[operator].py
[
--cpu
|
--nvidia
|
--cambricon
|
--ascend
]
```
#### 算子测试框架
详见
`test/infiniop-test`
目录
## 开发指南
### 代码格式化
...
...
include/infinicore.h
View file @
4ffb2f73
...
...
@@ -65,10 +65,10 @@ typedef enum {
INFINI_DTYPE_F16
=
12
,
INFINI_DTYPE_F32
=
13
,
INFINI_DTYPE_F64
=
14
,
INFINI_DTYPE_C
8
=
15
,
INFINI_DTYPE_C
16
=
16
,
INFINI_DTYPE_C
32
=
17
,
INFINI_DTYPE_C
64
=
18
,
INFINI_DTYPE_C
16
=
15
,
INFINI_DTYPE_C
32
=
16
,
INFINI_DTYPE_C
64
=
17
,
INFINI_DTYPE_C
128
=
18
,
INFINI_DTYPE_BF16
=
19
,
}
infiniDtype_t
;
...
...
scripts/install.bat
0 → 100644
View file @
4ffb2f73
@echo
off
setlocal
:: Check if project path is provided
if
"
%
~0"
==
""
(
echo
Usage
:
install
.bat
PROJECT_PATH
[
XMAKE_CONFIG_FLAGS
]
exit
/b
1
)
:: Set INFINI_ROOT
set
"INFINI_ROOT=
%USERPROFILE%
\.infini"
:: Check if INFINI_ROOT\bin is already in PATH, if not, add it
echo
%PATH%
|
findstr
/I /C
:
"
%INFINI_ROOT%
\bin"
>
nul
if
%errorlevel%
neq
0
set
"PATH=
%INFINI_ROOT%
\bin;
%PATH%
"
:: Convert relative path to absolute path
for
%%I
in
(
"
%
~1"
)
do
set
ABS_PATH
=
%%~fI
:: Change to the project directory
cd
%ABS_PATH%
:: Build xmake config flags
set
XMAKE_FLAGS
=
set
i
=
0
for
%%A
in
(
%
*)
do
(
if
!i!
gtr
set
XMAKE_FLAGS
=
!XMAKE_FLAGS!
%%A
set
/a
i
+=
1
)
:: Start installation
xmake
clean
-a
if
%errorlevel%
neq
0
exit
/b
%errorlevel%
xmake
f
%XMAKE_FLAGS%
-cv
if
%errorlevel%
neq
0
exit
/b
%errorlevel%
xmake
if
%errorlevel%
neq
0
exit
/b
%errorlevel%
xmake
install
if
%errorlevel%
neq
0
exit
/b
%errorlevel%
xmake
build
infiniop
-test
if
%errorlevel%
neq
0
exit
/b
%errorlevel%
xmake
install
infiniop
-test
if
%errorlevel%
neq
0
exit
/b
%errorlevel%
scripts/install.sh
0 → 100644
View file @
4ffb2f73
#!/bin/bash
set
-e
# Exit on error
# Check if project path is provided
if
[
-z
"
$1
"
]
;
then
echo
"Usage: source deploy.sh PROJECT_PATH [XMAKE_CONFIG_FLAGS]"
exit
1
fi
# Set INFINI_ROOT
export
INFINI_ROOT
=
"
$HOME
/.infini"
# Check if INFINI_ROOT/bin is already in PATH, if not, add it
case
":
$PATH
:"
in
*
":
$INFINI_ROOT
/bin:"
*
)
;;
# Already in PATH, do nothing
*
)
export
PATH
=
"
$INFINI_ROOT
/bin:
$PATH
"
;;
# Add to PATH
esac
# Check if INFINI_ROOT/lib is already in LD_LIBRARY_PATH, if not, add it
case
":
$LD_LIBRARY_PATH
:"
in
*
":
$INFINI_ROOT
/lib:"
*
)
;;
# Already in LD_LIBRARY_PATH, do nothing
*
)
export
LD_LIBRARY_PATH
=
"
$INFINI_ROOT
/lib:
$LD_LIBRARY_PATH
"
;;
# Add to LD_LIBRARY_PATH
esac
# Change to project directory
cd
"
$1
"
# Shift first argument (project path) and pass the rest to xmake
shift
xmake clean
-a
xmake f
"
$@
"
-cv
xmake
xmake
install
xmake build infiniop-test
xmake
install
infiniop-test
src/utils.h
View file @
4ffb2f73
...
...
@@ -38,13 +38,13 @@ inline size_t infiniSizeOf(infiniDtype_t dtype) {
return
4
;
case
INFINI_DTYPE_F64
:
return
8
;
case
INFINI_DTYPE_C8
:
return
2
;
case
INFINI_DTYPE_C16
:
return
4
;
return
2
;
case
INFINI_DTYPE_C32
:
return
8
;
return
4
;
case
INFINI_DTYPE_C64
:
return
8
;
case
INFINI_DTYPE_C128
:
return
16
;
case
INFINI_DTYPE_BF16
:
return
2
;
...
...
@@ -85,14 +85,14 @@ inline std::string infiniDtypeToString(infiniDtype_t dtype) {
return
"F32"
;
case
INFINI_DTYPE_F64
:
return
"F64"
;
case
INFINI_DTYPE_C8
:
return
"C8"
;
case
INFINI_DTYPE_C16
:
return
"C16"
;
case
INFINI_DTYPE_C32
:
return
"C32"
;
case
INFINI_DTYPE_C64
:
return
"C64"
;
case
INFINI_DTYPE_C128
:
return
"C128"
;
case
INFINI_DTYPE_BF16
:
return
"BF16"
;
default:
...
...
xmake/test.lua
View file @
4ffb2f73
target
(
"infiniutils-test"
)
set_kind
(
"binary"
)
add_deps
(
"infini-utils"
)
on_install
(
function
(
target
)
end
)
set_warnings
(
"all"
,
"error"
)
set_languages
(
"cxx17"
)
add_files
(
os
.
projectdir
()
..
"/src/utils-test/*.cc"
)
set_installdir
(
os.getenv
(
"INFINI_ROOT"
)
or
(
os.getenv
(
is_host
(
"windows"
)
and
"HOMEPATH"
or
"HOME"
)
..
"/.infini"
))
target_end
()
target
(
"infiniop-test"
)
set_kind
(
"binary"
)
add_deps
(
"infini-utils"
)
on_install
(
function
(
target
)
end
)
set_default
(
false
)
local
INFINI_ROOT
=
os.getenv
(
"INFINI_ROOT"
)
or
(
os.getenv
(
is_host
(
"windows"
)
and
"HOMEPATH"
or
"HOME"
)
..
"/.infini"
)
...
...
@@ -31,4 +31,6 @@ target("infiniop-test")
add_includedirs
(
os
.
projectdir
()
..
"/src/infiniop-test/include"
)
add_files
(
os
.
projectdir
()
..
"/src/infiniop-test/src/*.cpp"
)
add_files
(
os
.
projectdir
()
..
"/src/infiniop-test/src/ops/*.cpp"
)
set_installdir
(
INFINI_ROOT
)
target_end
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment