Commit 9a1f7817 authored by rusty1s's avatar rusty1s
Browse files

clean up

parent e6638edd
#include <TH/TH.h>
#define cluster_(NAME) TH_CONCAT_4(cluster_, NAME, _, Real)
#define SERIAL(output, row, col, degree, SELECT) { \
int64_t *output_data = output->storage->data + output->storageOffset; \
int64_t *row_data = row->storage->data + row->storageOffset; \
int64_t *col_data = col->storage->data + col->storageOffset; \
int64_t *degree_data = degree->storage->data + degree->storageOffset; \
\
int64_t e = 0, row_value, col_value, v; \
while(e < THLongTensor_nElement(row)) { \
row_value = row_data[e]; \
if (output_data[row_value] < 0) { \
col_value = row_value; \
SELECT \
v = row_value < col_value ? row_value : col_value; \
output_data[row_value] = v; \
output_data[col_value] = v; \
} \
e += degree_data[row_value]; \
} \
}
void cluster_serial(THLongTensor *output, THLongTensor *row, THLongTensor *col, THLongTensor *degree) {
int64_t d, c;
SERIAL(output, row, col, degree,
for (d = 0; d < degree_data[row_value]; d++) { // Iterate over neighbors.
c = col_data[e + d];
if (output_data[c] < 0) { // Neighbor is unmatched.
col_value = c;
break;
}
}
)
}
#include "generic/serial_cpu.c"
#include "THGenerateAllTypes.h"
void cluster_serial(THLongTensor *output, THLongTensor *row, THLongTensor *col, THLongTensor *degree);
void cluster_serial_Float (THLongTensor *output, THLongTensor *row, THLongTensor *col, THLongTensor *degree, THFloatTensor *weight);
void cluster_serial_Double(THLongTensor *output, THLongTensor *row, THLongTensor *col, THLongTensor *degree, THDoubleTensor *weight);
void cluster_serial_Byte (THLongTensor *output, THLongTensor *row, THLongTensor *col, THLongTensor *degree, THByteTensor *weight);
void cluster_serial_Char (THLongTensor *output, THLongTensor *row, THLongTensor *col, THLongTensor *degree, THCharTensor *weight);
void cluster_serial_Short (THLongTensor *output, THLongTensor *row, THLongTensor *col, THLongTensor *degree, THShortTensor *weight);
void cluster_serial_Int (THLongTensor *output, THLongTensor *row, THLongTensor *col, THLongTensor *degree, THIntTensor *weight);
void cluster_serial_Long (THLongTensor *output, THLongTensor *row, THLongTensor *col, THLongTensor *degree, THLongTensor *weight);
#include <THC/THC.h>
#include "serial.h"
#define cluster_(NAME) TH_CONCAT_4(cluster_, NAME, _cuda_, Real)
#define cluster_kernel_(NAME) TH_CONCAT_4(cluster_, NAME, _kernel_, Real)
extern THCState *state;
void cluster_serial_cuda(THCudaLongTensor *output, THCudaLongTensor *row, THCudaLongTensor *col, THCudaLongTensor *degree) {
int bla = assignColor(state, output);
printf("RETURN TYPE IS %i \n", bla);
/* cluster_serial_kernel(state, output, row, col, degree); */
}
#include "generic/serial_cuda.c"
#include "THCGenerateFloatType.h"
#include "generic/serial_cuda.c"
#include "THCGenerateDoubleType.h"
#include "generic/serial_cuda.c"
#include "THCGenerateByteType.h"
#include "generic/serial_cuda.c"
#include "THCGenerateCharType.h"
#include "generic/serial_cuda.c"
#include "THCGenerateShortType.h"
#include "generic/serial_cuda.c"
#include "THCGenerateIntType.h"
#include "generic/serial_cuda.c"
#include "THCGenerateLongType.h"
void cluster_serial_cuda(THCudaLongTensor *output, THCudaLongTensor *row, THCudaLongTensor *col, THCudaLongTensor *degree);
void cluster_serial_cuda_Float (THCudaLongTensor *output, THCudaLongTensor *row, THCudaLongTensor *col, THCudaLongTensor *degree, THCudaTensor *weight);
void cluster_serial_cuda_Double(THCudaLongTensor *output, THCudaLongTensor *row, THCudaLongTensor *col, THCudaLongTensor *degree, THCudaDoubleTensor *weight);
void cluster_serial_cuda_Byte (THCudaLongTensor *output, THCudaLongTensor *row, THCudaLongTensor *col, THCudaLongTensor *degree, THCudaByteTensor *weight);
void cluster_serial_cuda_Char (THCudaLongTensor *output, THCudaLongTensor *row, THCudaLongTensor *col, THCudaLongTensor *degree, THCudaCharTensor *weight);
void cluster_serial_cuda_Short (THCudaLongTensor *output, THCudaLongTensor *row, THCudaLongTensor *col, THCudaLongTensor *degree, THCudaShortTensor *weight);
void cluster_serial_cuda_Int (THCudaLongTensor *output, THCudaLongTensor *row, THCudaLongTensor *col, THCudaLongTensor *degree, THCudaIntTensor *weight);
void cluster_serial_cuda_Long (THCudaLongTensor *output, THCudaLongTensor *row, THCudaLongTensor *col, THCudaLongTensor *degree, THCudaLongTensor *weight);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment