Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xpuremoting support #22

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
[submodule "remoting"]
path = remoting
url = https://github.com/SJTU-IPADS/PhoenixOS-Remoting.git
branch = v0.10-cricket
branch = main
1 change: 0 additions & 1 deletion examples/llama2-13b-chat-hf/llama_bk
Submodule llama_bk deleted from e280a0
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ sources += [
'pos/src/oob/mgnt.cpp',

# binding functions for remoting framework
# 'pos/src/remoting/agent.cpp',
'pos/src/remoting/agent.cpp',

# protobuf generated file
'pos/include/proto/client.pb.cc',
Expand Down Expand Up @@ -324,7 +324,7 @@ if conf_runtime_target == 'cuda'
'pos/cuda_impl/src/handle/var.cpp',

# binding functions for remoting framework
# 'pos/cuda_impl/src/remoting/workspace.cpp',
'pos/cuda_impl/src/remoting/workspace.cpp',

# protobuf generated file
'pos/cuda_impl/proto/context.pb.cc',
Expand Down
2 changes: 1 addition & 1 deletion pos/cli/src/start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pos_retval_t handle_start(pos_cli_options_t &clio){

if(!strcmp(clio.metas.start.target_name, "daemon")){
// start PhOS daemomn
phosd_cmd = std::string("cricket-rpc-server");
phosd_cmd = std::string("xpu-server");
retval = POSUtil_Command_Caller::exec_sync(
phosd_cmd,
phosd_result,
Expand Down
2 changes: 0 additions & 2 deletions pos/cuda_impl/src/parser/cuda_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ namespace cuda_launch_kernel {
args = pos_api_param_addr(wqe, 3);
POS_CHECK_POINTER(args);

// [Cricket Adapt] skip the metadata used by cricket
args += (sizeof(size_t) + sizeof(uint16_t) * function_handle->nb_params);

/*!
* \note record all input memory areas
Expand Down
2 changes: 0 additions & 2 deletions pos/cuda_impl/src/worker/cuda_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,6 @@ namespace cuda_launch_kernel {
args = pos_api_param_addr(wqe, 3);
POS_CHECK_POINTER(args);

// [Cricket Adapt] skip the metadata used by cricket
args += (sizeof(size_t) + sizeof(uint16_t) * function_handle->nb_params);

/*!
* \note the actual kernel parameter list passed to the cuLaunchKernel is
Expand Down
2 changes: 1 addition & 1 deletion remoting
Submodule remoting updated 825 files
2 changes: 1 addition & 1 deletion scripts/build_scripts/cuda.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func CRIB_PhOS_CUDA(cmdOpt CmdOptions, buildConf BuildConfigs, logger *log.Logge
tmux kill-session -t cargo_installer
fi
tmux new -s cargo_installer -d
tmux send -t cargo_installer "curl https://sh.rustup.rs -sSf | sh; exit 0" ENTER
tmux send -t cargo_installer "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly; exit 0" ENTER
tmux send-keys -t cargo_installer C-m
echo '. "$HOME/.cargo/env"' >> /etc/profile
`,
Expand Down
6 changes: 3 additions & 3 deletions scripts/build_scripts/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ func main() {

if cmdOpt.DoInstall {
// insert environment variable to /etc/profile file
ldPreload := "export phos=\"LD_PRELOAD=cricket-client.so\"\n"
exists, err := utils.CheckContentExists("/etc/profile", ldPreload)
envVars := "export phos=\"LD_PRELOAD=libxpuclient.so\" RUST_LOG=error\n"
exists, err := utils.CheckContentExists("/etc/profile", envVars)
if err != nil {
logger.Fatalf("failed to check file content of /etc/profile")
}
Expand All @@ -113,7 +113,7 @@ func main() {
}
defer file.Close()

if _, err := file.WriteString(ldPreload); err != nil {
if _, err := file.WriteString(envVars); err != nil {
logger.Fatal("failed to write /etc/profile: %v", err)
}
}
Expand Down
36 changes: 14 additions & 22 deletions scripts/build_scripts/pos.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,35 @@ func CRIB_PhOS_Remoting(cmdOpt CmdOptions, buildConf BuildConfigs, logger *log.L
{{.CMD_EXPRORT_ENV_VAR__}}
export POS_ENABLE=true
cd %s/%s
make libtirpc -j >>{{.LOG_PATH__}} 2>&1
cp ./submodules/libtirpc/install/lib/libtirpc.so {{.LOCAL_LIB_PATH__}}/libtirpc.so >>{{.LOG_PATH__}} 2>&1
cd cpu
make clean >>{{.LOG_PATH__}} 2>&1
LOG=INFO make cricket-rpc-server cricket-client.so -j >>{{.LOG_PATH__}} 2>&1
cp cricket-rpc-server {{.LOCAL_BIN_PATH__}}/cricket-rpc-server >>{{.LOG_PATH__}} 2>&1
cp cricket-client.so {{.LOCAL_LIB_PATH__}}/cricket-client.so >>{{.LOG_PATH__}} 2>&1
LIBPOS_PATH=../lib cargo build --features phos,async_api --release >>{{.LOG_PATH__}} 2>&1
cd target/release
cp server {{.LOCAL_BIN_PATH__}}/xpu-server >>{{.LOG_PATH__}} 2>&1
cp libclient.so {{.LOCAL_LIB_PATH__}}/libxpuclient.so >>{{.LOG_PATH__}} 2>&1
`,
cmdOpt.RootDir, KRemotingPath,
)

install_script := fmt.Sprintf(`
#!/bin/bash
set -e
cd %s/%s
cp ./submodules/libtirpc/install/lib/libtirpc.so {{.SYSTEM_LIB_PATH__}}/libtirpc.so >>{{.LOG_PATH__}} 2>&1
cd cpu
cp cricket-rpc-server {{.SYSTEM_BIN_PATH__}}/cricket-rpc-server >>{{.LOG_PATH__}} 2>&1
cp cricket-client.so {{.SYSTEM_LIB_PATH__}}/cricket-client.so >>{{.LOG_PATH__}} 2>&1
cd %s/%s/target/release >>{{.LOG_PATH__}} 2>&1
cp server {{.SYSTEM_BIN_PATH__}}/xpu-server >>{{.LOG_PATH__}} 2>&1
cp libclient.so {{.SYSTEM_LIB_PATH__}}/libxpuclient.so >>{{.LOG_PATH__}} 2>&1
`,
cmdOpt.RootDir, KRemotingPath,
)

clean_script := fmt.Sprintf(`
# set -e
#set -e
cd %s/%s
make clean >>{{.LOG_PATH__}} 2>&1
cd cpu
make clean >>{{.LOG_PATH__}} 2>&1
cargo clean >>{{.LOG_PATH__}} 2>&1
# clean local installcation
rm -rf {{.LOCAL_BIN_PATH__}}/cricket-rpc-server >>{{.LOG_PATH__}} 2>&1
rm -rf {{.LOCAL_LIB_PATH__}}/libtirpc.so >>{{.LOG_PATH__}} 2>&1
rm -rf {{.LOCAL_LIB_PATH__}}/cricket-client.so >>{{.LOG_PATH__}} 2>&1
rm -rf {{.LOCAL_BIN_PATH__}}/xpu-server >>{{.LOG_PATH__}} 2>&1
rm -rf {{.LOCAL_LIB_PATH__}}/libxpuclient.so >>{{.LOG_PATH__}} 2>&1

# clean system installation
rm -rf {{.SYSTEM_BIN_PATH__}}/cricket-rpc-server >>{{.LOG_PATH__}} 2>&1
rm -rf {{.SYSTEM_LIB_PATH__}}/libtirpc.so >>{{.LOG_PATH__}} 2>&1
rm -rf {{.SYSTEM_LIB_PATH__}}/cricket-client.so >>{{.LOG_PATH__}} 2>&1
rm -rf {{.SYSTEM_BIN_PATH__}}/xpu-server >>{{.LOG_PATH__}} 2>&1
rm -rf {{.SYSTEM_LIB_PATH__}}/libxpuclient.so >>{{.LOG_PATH__}} 2>&1
`,
cmdOpt.RootDir, KRemotingPath,
)
Expand Down