Skip to content

Commit

Permalink
Remove flagcx_hetero.cc and hostGpuMemAlloc.h (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
haobaba5353 authored Dec 20, 2024
1 parent 83df87f commit cb79eb3
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 493 deletions.
17 changes: 0 additions & 17 deletions flagcx/core/flagcx_hetero.cc

This file was deleted.

1 change: 1 addition & 0 deletions flagcx/core/group.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "assert.h"
#include "net.h"
#include "adaptor.h"
#include "launch_kernel.h"

__thread int flagcxGroupDepth = 0;
__thread bool flagcxGroupJobAbortFlag = false;
Expand Down
363 changes: 0 additions & 363 deletions flagcx/core/hostGpuMemAlloc.h

This file was deleted.

7 changes: 7 additions & 0 deletions flagcx/core/launch_kernel.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "launch_kernel.h"

void cpuAsyncLaunch(void *_args){
struct hostLaunchArgs *args = (struct hostLaunchArgs *) _args;
while(!args->stopLaunch);
__atomic_store_n(&args->retLaunch, 1, __ATOMIC_RELAXED);
}
27 changes: 27 additions & 0 deletions flagcx/core/launch_kernel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef FLAGCX_LAUNCH_KERNEL_H_
#define FLAGCX_LAUNCH_KERNEL_H_

#include "topo.h"
#include "debug.h"
#include <stdlib.h>
#include <getopt.h>
#include <memory.h>
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <iomanip>
#include <unistd.h>
#include <dlfcn.h>
#include "adaptor.h"
#include "utils.h"
#include "param.h"

struct hostLaunchArgs{
volatile bool stopLaunch;
volatile bool retLaunch;
};

void cpuAsyncLaunch(void *_args);

#endif

2 changes: 1 addition & 1 deletion flagcx/core/proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <pthread.h>
#include "info.h"
#include "net.h"
#include "hostGpuMemAlloc.h"
#include "launch_kernel.h"

enum flagcxProxyOpState { flagcxProxyOpNone, flagcxProxyOpReady, flagcxProxyOpProgress };

Expand Down
1 change: 0 additions & 1 deletion flagcx/core/topo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include "bootstrap.h"
#include "hostGpuMemAlloc.h"

#define BUSID_SIZE (sizeof("0000:00:00.0"))
#define BUSID_REDUCED_SIZE (sizeof("0000:00"))
Expand Down
10 changes: 10 additions & 0 deletions flagcx/core/topo.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,14 @@ static int mirrorBits(int val, int pow2) {
for (int b=1, mb=(pow2>>1); b<pow2; b<<=1, mb>>=1) if (val & b) mirror |= mb;
return mirror;
}


#ifdef CREATE_DEVICE_TOPO_API
#define DEVICE_TOPO_API_EXTERN
#else
#define DEVICE_TOPO_API_EXTERN extern
#endif

DEVICE_TOPO_API_EXTERN flagcxResult_t (*flagcxTopoGetLocalNet)(int gpu, char *name);

#endif
1 change: 0 additions & 1 deletion flagcx/core/transport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "net.h"
#include "topo.h"
#include "adaptor.h"
#include "hostGpuMemAlloc.h"
#define ENABLE_TIMER 0
#include "timer.h"

Expand Down
110 changes: 0 additions & 110 deletions flagcx/service/launch_kernel.cc

This file was deleted.

45 changes: 45 additions & 0 deletions flagcx/service/load_devapi.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#define CREATE_DEVICE_TOPO_API
#include "topo.h"
#include "debug.h"
#include <stdlib.h>
#include <getopt.h>
#include <memory.h>
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <iomanip>
#include <unistd.h>
#include <dlfcn.h>
#include "adaptor.h"
#include "utils.h"
#include "param.h"

using namespace std;

struct flagcxDeviceAdaptor devRunTimeApi;

void *dlsymCheck(void *handle, const char *funcName){
void *funcPtr = dlsym(handle, funcName);
if(funcPtr == NULL) INFO(FLAGCX_INIT, "fail to load symbol %s", funcName);
return funcPtr;
}

#define LOADSYMBOL(handle,api) do{ \
api = (typeof(api)) dlsymCheck(handle, #api); \
}while(0);

flagcxResult_t loadDeviceSymbol(){
void *libHandle = dlopen("./libmylib.so", RTLD_LAZY);
if(libHandle == nullptr){
const char* useNet = flagcxGetEnv("FLAGCX_USENET");
if(useNet == NULL){
INFO(FLAGCX_INIT, "fail to open libmylib.so");
return flagcxRemoteError;
}
return flagcxSuccess;
}

LOADSYMBOL(libHandle, flagcxTopoGetLocalNet);
return flagcxSuccess;
}

0 comments on commit cb79eb3

Please sign in to comment.