Skip to content

Commit

Permalink
pcie.c portion and optimal-gpu decision was moved to heterodb-extra
Browse files Browse the repository at this point in the history
  • Loading branch information
kaigai committed Apr 21, 2024
1 parent 72640e0 commit 991572b
Show file tree
Hide file tree
Showing 7 changed files with 588 additions and 94 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ STROM_OBJS = main.o githash.o extra.o codegen.o misc.o executor.o \
gpu_scan.o gpu_join.o gpu_preagg.o \
relscan.o brin.o gist.o gpu_cache.o \
arrow_fdw.o arrow_nodes.o \
pcie.o float2.o tinyint.o aggfuncs.o
float2.o tinyint.o aggfuncs.o
GENERATED-HEADERS = gpu_devattrs.h githash.c
STROM_HEADERS = arrow_defs.h arrow_ipc.h float2.h

Expand Down
55 changes: 43 additions & 12 deletions src/extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,48 @@ heterodbLicenseQuery(char *buf, size_t bufsz)
/*
* heterodbValidateDevice
*/
static int (*p_heterodb_validate_device)(int gpu_device_id,
const char *gpu_device_name,
const char *gpu_device_uuid) = NULL;
bool
heterodbValidateDevice(int gpu_device_id,
const char *gpu_device_name,
static int (*p_heterodb_validate_device_v2)(const char *gpu_device_name,
const char *gpu_device_uuid) = NULL;
int
heterodbValidateDevice(const char *gpu_device_name,
const char *gpu_device_uuid)
{
if (!p_heterodb_validate_device)
return false;
return (p_heterodb_validate_device(gpu_device_id,
gpu_device_name,
gpu_device_uuid) > 0);
if (!p_heterodb_validate_device_v2)
return -1;
return (p_heterodb_validate_device_v2(gpu_device_name,
gpu_device_uuid));
}

/*
* heterodbInitOptimalGpus
*/
static const char *(*p_heterodb_init_optimal_gpus)(const char *manual_config) = NULL;

const char *
heterodbInitOptimalGpus(const char *manual_config)
{
const char *json = NULL;

if (p_heterodb_init_optimal_gpus)
{
json = p_heterodb_init_optimal_gpus(manual_config);
if (!json)
heterodbExtraEreport(ERROR);
}
return json;
}

/*
* heterodbGetOptimalGpus
*/
static int64_t (*p_heterodb_get_optimal_gpus)(const char *path) = NULL;

int64_t
heterodbGetOptimalGpus(const char *path)
{
if (p_heterodb_get_optimal_gpus)
return p_heterodb_get_optimal_gpus(path);
return 0;
}

/*
Expand Down Expand Up @@ -844,7 +873,9 @@ pgstrom_init_extra(void)
gpuDirectInitDriver();
LOOKUP_HETERODB_EXTRA_FUNCTION(heterodb_license_reload);
LOOKUP_HETERODB_EXTRA_FUNCTION(heterodb_license_query);
LOOKUP_HETERODB_EXTRA_FUNCTION(heterodb_validate_device);
LOOKUP_HETERODB_EXTRA_FUNCTION(heterodb_validate_device_v2);
LOOKUP_HETERODB_EXTRA_FUNCTION(heterodb_init_optimal_gpus);
LOOKUP_HETERODB_EXTRA_FUNCTION(heterodb_get_optimal_gpus);
elog(LOG, "HeteroDB Extra module loaded [%s]", extra_module_info);

memset(enum_options, 0, sizeof(enum_options));
Expand Down
Loading

0 comments on commit 991572b

Please sign in to comment.