Commit 6ac701f8 authored by sangwzh's avatar sangwzh
Browse files

update src and graphbolt code

parent 1547bd93
// !!! This is a file automatically generated by hipify!!!
/** /**
* Copyright (c) 2021 Intel Corporation * Copyright (c) 2021 Intel Corporation
* *
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
#include <vector> #include <vector>
#include "../c_api_common.h" #include "../c_api_common.h"
#include "./check.h" #include "check.h"
#include "kernel_decl.h" #include "kernel_decl.h"
using namespace dgl::runtime; using namespace dgl::runtime;
......
// !!! This is a file automatically generated by hipify!!!
/** /**
* Copyright (c) 2020 by Contributors * Copyright (c) 2020 by Contributors
* @file array/selector.h * @file array/selector.h
...@@ -12,13 +13,13 @@ namespace dgl { ...@@ -12,13 +13,13 @@ namespace dgl {
namespace { namespace {
#ifdef __CUDACC__ #ifdef __HIPCC__
#define DGLDEVICE __device__ #define DGLDEVICE __device__ __host__
#define DGLINLINE __forceinline__ #define DGLINLINE __forceinline__
#else #else
#define DGLDEVICE #define DGLDEVICE
#define DGLINLINE inline #define DGLINLINE inline
#endif // __CUDACC__ #endif // __HIPCC__
} // namespace } // namespace
......
// !!! This is a file automatically generated by hipify!!!
/** /**
* Copyright (c) 2019-2022 by Contributors * Copyright (c) 2019-2022 by Contributors
* @file array/uvm_array.cc * @file array/uvm_array.cc
...@@ -8,7 +9,7 @@ ...@@ -8,7 +9,7 @@
#include <sstream> #include <sstream>
#include "../c_api_common.h" #include "../c_api_common.h"
#include "./uvm_array_op.h" #include "uvm_array_op.h"
using namespace dgl::runtime; using namespace dgl::runtime;
......
// !!! This is a file automatically generated by hipify!!!
#include "hip/hip_runtime.h"
/** /**
* Copyright (c) 2019 by Contributors * Copyright (c) 2019 by Contributors
* @file geometry/cuda/edge_coarsening_impl.cu * @file geometry/cuda/edge_coarsening_impl.cu
* @brief Edge coarsening CUDA implementation * @brief Edge coarsening CUDA implementation
*/ */
#include <curand_kernel.h> #include <hiprand/hiprand_kernel.h>
#include <dgl/array.h> #include <dgl/array.h>
#include <dgl/random.h> #include <dgl/random.h>
#include <dmlc/thread_local.h> #include <dmlc/thread_local.h>
...@@ -32,9 +34,9 @@ __global__ void generate_uniform_kernel( ...@@ -32,9 +34,9 @@ __global__ void generate_uniform_kernel(
float *ret_values, size_t num, uint64_t seed) { float *ret_values, size_t num, uint64_t seed) {
size_t id = blockIdx.x * blockDim.x + threadIdx.x; size_t id = blockIdx.x * blockDim.x + threadIdx.x;
if (id < num) { if (id < num) {
curandState state; hiprandState_t state;
curand_init(seed, id, 0, &state); hiprand_init(seed, id, 0, &state);
ret_values[id] = curand_uniform(&state); ret_values[id] = hiprand_uniform(&state);
} }
} }
...@@ -116,7 +118,7 @@ __global__ void weighted_respond_kernel( ...@@ -116,7 +118,7 @@ __global__ void weighted_respond_kernel(
template <typename IdType> template <typename IdType>
bool Colorize(IdType *result_data, int64_t num_nodes, float *const prop) { bool Colorize(IdType *result_data, int64_t num_nodes, float *const prop) {
// initial done signal // initial done signal
cudaStream_t stream = runtime::getCurrentCUDAStream(); hipStream_t stream = runtime::getCurrentHIPStreamMasqueradingAsCUDA();
CUDA_KERNEL_CALL(init_done_kernel, 1, 1, 0, stream); CUDA_KERNEL_CALL(init_done_kernel, 1, 1, 0, stream);
// generate color prop for each node // generate color prop for each node
...@@ -132,8 +134,8 @@ bool Colorize(IdType *result_data, int64_t num_nodes, float *const prop) { ...@@ -132,8 +134,8 @@ bool Colorize(IdType *result_data, int64_t num_nodes, float *const prop) {
colorize_kernel, num_blocks, num_threads, 0, stream, prop, num_nodes, colorize_kernel, num_blocks, num_threads, 0, stream, prop, num_nodes,
result_data); result_data);
bool done_h = false; bool done_h = false;
CUDA_CALL(cudaMemcpyFromSymbol( CUDA_CALL(hipMemcpyFromSymbol(
&done_h, done_d, sizeof(done_h), 0, cudaMemcpyDeviceToHost)); &done_h, done_d, sizeof(done_h), 0, hipMemcpyDeviceToHost));
return done_h; return done_h;
} }
...@@ -155,7 +157,7 @@ bool Colorize(IdType *result_data, int64_t num_nodes, float *const prop) { ...@@ -155,7 +157,7 @@ bool Colorize(IdType *result_data, int64_t num_nodes, float *const prop) {
template <DGLDeviceType XPU, typename FloatType, typename IdType> template <DGLDeviceType XPU, typename FloatType, typename IdType>
void WeightedNeighborMatching( void WeightedNeighborMatching(
const aten::CSRMatrix &csr, const NDArray weight, IdArray result) { const aten::CSRMatrix &csr, const NDArray weight, IdArray result) {
cudaStream_t stream = runtime::getCurrentCUDAStream(); hipStream_t stream = runtime::getCurrentHIPStreamMasqueradingAsCUDA();
const auto &ctx = result->ctx; const auto &ctx = result->ctx;
auto device = runtime::DeviceAPI::Get(ctx); auto device = runtime::DeviceAPI::Get(ctx);
device->SetDevice(ctx); device->SetDevice(ctx);
...@@ -216,7 +218,7 @@ void NeighborMatching(const aten::CSRMatrix &csr, IdArray result) { ...@@ -216,7 +218,7 @@ void NeighborMatching(const aten::CSRMatrix &csr, IdArray result) {
device->SetDevice(ctx); device->SetDevice(ctx);
// generate random weights // generate random weights
cudaStream_t stream = runtime::getCurrentCUDAStream(); hipStream_t stream = runtime::getCurrentHIPStreamMasqueradingAsCUDA();
NDArray weight = NDArray::Empty( NDArray weight = NDArray::Empty(
{num_edges}, DGLDataType{kDGLFloat, sizeof(float) * 8, 1}, ctx); {num_edges}, DGLDataType{kDGLFloat, sizeof(float) * 8, 1}, ctx);
float *weight_data = static_cast<float *>(weight->data); float *weight_data = static_cast<float *>(weight->data);
......
// !!! This is a file automatically generated by hipify!!!
#include "hip/hip_runtime.h"
/** /**
* Copyright (c) 2019 by Contributors * Copyright (c) 2019 by Contributors
* @file geometry/cuda/geometry_op_impl.cc * @file geometry/cuda/geometry_op_impl.cc
...@@ -95,7 +97,7 @@ template <DGLDeviceType XPU, typename FloatType, typename IdType> ...@@ -95,7 +97,7 @@ template <DGLDeviceType XPU, typename FloatType, typename IdType>
void FarthestPointSampler( void FarthestPointSampler(
NDArray array, int64_t batch_size, int64_t sample_points, NDArray dist, NDArray array, int64_t batch_size, int64_t sample_points, NDArray dist,
IdArray start_idx, IdArray result) { IdArray start_idx, IdArray result) {
cudaStream_t stream = runtime::getCurrentCUDAStream(); hipStream_t stream = runtime::getCurrentHIPStreamMasqueradingAsCUDA();
const FloatType* array_data = static_cast<FloatType*>(array->data); const FloatType* array_data = static_cast<FloatType*>(array->data);
...@@ -110,7 +112,7 @@ void FarthestPointSampler( ...@@ -110,7 +112,7 @@ void FarthestPointSampler(
// sample for each cloud in the batch // sample for each cloud in the batch
IdType* start_idx_data = static_cast<IdType*>(start_idx->data); IdType* start_idx_data = static_cast<IdType*>(start_idx->data);
CUDA_CALL(cudaSetDevice(array->ctx.device_id)); CUDA_CALL(hipSetDevice(array->ctx.device_id));
CUDA_KERNEL_CALL( CUDA_KERNEL_CALL(
fps_kernel, batch_size, THREADS, 0, stream, array_data, batch_size, fps_kernel, batch_size, THREADS, 0, stream, array_data, batch_size,
......
// !!! This is a file automatically generated by hipify!!!
/** /**
* Copyright (c) 2019 by Contributors * Copyright (c) 2019 by Contributors
* @file geometry/geometry.cc * @file geometry/geometry.cc
...@@ -10,7 +11,7 @@ ...@@ -10,7 +11,7 @@
#include "../array/check.h" #include "../array/check.h"
#include "../c_api_common.h" #include "../c_api_common.h"
#include "./geometry_op.h" #include "geometry_op.h"
using namespace dgl::runtime; using namespace dgl::runtime;
......
// !!! This is a file automatically generated by hipify!!!
/** /**
* Copyright (c) 2020 by Contributors * Copyright (c) 2020 by Contributors
* @file graph/creators.cc * @file graph/creators.cc
* @brief Functions for constructing graphs. * @brief Functions for constructing graphs.
*/ */
#include "./heterograph.h" #include "heterograph.h"
using namespace dgl::runtime; using namespace dgl::runtime;
namespace dgl { namespace dgl {
......
// !!! This is a file automatically generated by hipify!!!
/** /**
* Copyright (c) 2019 by Contributors * Copyright (c) 2019 by Contributors
* @file graph/heterograph.cc * @file graph/heterograph.cc
* @brief Heterograph implementation * @brief Heterograph implementation
*/ */
#include "./heterograph.h" #include "heterograph.h"
#include <dgl/array.h> #include <dgl/array.h>
#include <dgl/graph_serializer.h> #include <dgl/graph_serializer.h>
......
// !!! This is a file automatically generated by hipify!!!
/** /**
* Copyright (c) 2019 by Contributors * Copyright (c) 2019 by Contributors
* @file graph/heterograph.h * @file graph/heterograph.h
...@@ -18,7 +19,7 @@ ...@@ -18,7 +19,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "./unit_graph.h" #include "unit_graph.h"
#include "shared_mem_manager.h" #include "shared_mem_manager.h"
namespace dgl { namespace dgl {
......
// !!! This is a file automatically generated by hipify!!!
/** /**
* Copyright (c) 2020 by Contributors * Copyright (c) 2020 by Contributors
* @file graph/heterograph_capi.cc * @file graph/heterograph_capi.cc
...@@ -14,7 +15,7 @@ ...@@ -14,7 +15,7 @@
#include <set> #include <set>
#include "../c_api_common.h" #include "../c_api_common.h"
#include "./heterograph.h" #include "heterograph.h"
#include "unit_graph.h" #include "unit_graph.h"
using namespace dgl::runtime; using namespace dgl::runtime;
......
// !!! This is a file automatically generated by hipify!!!
/** /**
* Copyright (c) 2020 by Contributors * Copyright (c) 2020 by Contributors
* @file graph/pickle.cc * @file graph/pickle.cc
...@@ -10,7 +11,7 @@ ...@@ -10,7 +11,7 @@
#include <dmlc/memory_io.h> #include <dmlc/memory_io.h>
#include "../c_api_common.h" #include "../c_api_common.h"
#include "./heterograph.h" #include "heterograph.h"
#include "unit_graph.h" #include "unit_graph.h"
using namespace dgl::runtime; using namespace dgl::runtime;
......
This diff is collapsed.
This diff is collapsed.
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