mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-04-28 19:55:29 +00:00
* [npu] setup device utils (#5047) * [npu] add npu device support * [npu] support low level zero * [test] update npu zero plugin test * [hotfix] fix import * [test] recover tests * [npu] gemini support npu (#5052) * [npu] refactor device utils * [gemini] support npu * [example] llama2+gemini support npu * [kernel] add arm cpu adam kernel (#5065) * [kernel] add arm cpu adam * [optim] update adam optimizer * [kernel] arm cpu adam remove bf16 support
35 lines
945 B
Python
35 lines
945 B
Python
from .builder import Builder
|
|
|
|
|
|
class ArmCPUAdamBuilder(Builder):
|
|
NAME = "arm_cpu_adam"
|
|
PREBUILT_IMPORT_PATH = "colossalai._C.arm_cpu_adam"
|
|
ext_type = "cpu"
|
|
|
|
def __init__(self):
|
|
super().__init__(name=ArmCPUAdamBuilder.NAME, prebuilt_import_path=ArmCPUAdamBuilder.PREBUILT_IMPORT_PATH)
|
|
self.version_dependent_macros = ["-DVERSION_GE_1_1", "-DVERSION_GE_1_3", "-DVERSION_GE_1_5"]
|
|
|
|
# necessary 4 functions
|
|
def sources_files(self):
|
|
ret = [
|
|
self.csrc_abs_path("cpu_adam_arm.cpp"),
|
|
]
|
|
return ret
|
|
|
|
def include_dirs(self):
|
|
return [self.csrc_abs_path("includes")]
|
|
|
|
def cxx_flags(self):
|
|
extra_cxx_flags = [
|
|
"-std=c++14",
|
|
"-std=c++17",
|
|
"-g",
|
|
"-Wno-reorder",
|
|
"-fopenmp",
|
|
]
|
|
return ["-O3"] + self.version_dependent_macros + extra_cxx_flags
|
|
|
|
def nvcc_flags(self):
|
|
return []
|