Skip to content

Commit

Permalink
[NFC] polish colossalai/kernel/cuda_native/csrc/kernels/include/cuda_…
Browse files Browse the repository at this point in the history
…util.h code style (hpcaitech#641)
  • Loading branch information
XueFuzhao authored and binmakeswell committed Apr 6, 2022
1 parent 055d027 commit 10afec7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ void check_gpu_error(T result, char const *const func, const char *const file,
template <typename T>
void print_vec(const T *outv, std::string outn, int num_output_ele);

template <typename T>
T *cuda_malloc(size_t ele_num);
template <typename T> T *cuda_malloc(size_t ele_num);

void cuda_free(void *pdata);

template <typename T>
void check_nan_inf(const T *data_ptr, int dsize, bool check_nan_inf,
std::string file, int line, cudaStream_t stream);

#define CHECK_NAN_INF(ptr, size, stream) \
check_nan_inf((ptr), (size), true, __FILE__, __LINE__, (stream)); \
#define CHECK_NAN_INF(ptr, size, stream) \
check_nan_inf((ptr), (size), true, __FILE__, __LINE__, (stream)); \
check_nan_inf((ptr), (size), false, __FILE__, __LINE__, (stream))
9 changes: 4 additions & 5 deletions colossalai/kernel/cuda_native/csrc/kernels/include/dropout.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#pragma once

#include <string>
#include <cuda.h>
#include <cuda_fp16.h>
#include <stdio.h>
#include <string>

#include "kernels.h"

template <typename T>
class Dropout {
public:
template <typename T> class Dropout {
public:
struct Config {
float ratio;
bool training;
Expand Down Expand Up @@ -89,7 +88,7 @@ class Dropout {

void SetTrainingMode(bool training) { _config.training = training; }

private:
private:
uint8_t *_mask;
Config _config;
};

0 comments on commit 10afec7

Please sign in to comment.