diff --git a/cuML/src/dbscan/epsneigh/algo1.h b/cuML/src/dbscan/epsneigh/algo1.h index c9637cffbf..ab2662fe79 100644 --- a/cuML/src/dbscan/epsneigh/algo1.h +++ b/cuML/src/dbscan/epsneigh/algo1.h @@ -16,7 +16,7 @@ #pragma once -#include "cuda_utils.h" +#include #include "pack.h" namespace Dbscan { diff --git a/cuML/src/dbscan/epsneigh/algo2.h b/cuML/src/dbscan/epsneigh/algo2.h index 717b10422b..bac0e4f457 100644 --- a/cuML/src/dbscan/epsneigh/algo2.h +++ b/cuML/src/dbscan/epsneigh/algo2.h @@ -16,7 +16,7 @@ #pragma once -#include "../cuda_utils.h" +#include #include "../types.h" #include "pack.h" diff --git a/cuML/src/dbscan/epsneigh/algo3.h b/cuML/src/dbscan/epsneigh/algo3.h index 741842cd8d..cfd4cfa590 100644 --- a/cuML/src/dbscan/epsneigh/algo3.h +++ b/cuML/src/dbscan/epsneigh/algo3.h @@ -16,7 +16,7 @@ #pragma once -#include "../cuda_utils.h" +#include #include "../types.h" #include "pack.h" diff --git a/cuML/src/dbscan/epsneigh/algo4.h b/cuML/src/dbscan/epsneigh/algo4.h index 85d24eaf82..e6f576a208 100644 --- a/cuML/src/dbscan/epsneigh/algo4.h +++ b/cuML/src/dbscan/epsneigh/algo4.h @@ -17,7 +17,7 @@ #pragma once -#include "../cuda_utils.h" +#include #include "pack.h" #include "../common.h" diff --git a/cuML/src/dbscan/epsneigh/naive.h b/cuML/src/dbscan/epsneigh/naive.h index 3c3e27d6bf..cead0cd231 100644 --- a/cuML/src/dbscan/epsneigh/naive.h +++ b/cuML/src/dbscan/epsneigh/naive.h @@ -16,7 +16,7 @@ #pragma once -#include "../cuda_utils.h" +#include #include "pack.h" namespace Dbscan { diff --git a/cuML/src/dbscan/labelling/runner.h b/cuML/src/dbscan/labelling/runner.h index 1cf59ef6bb..bc845cc2cb 100644 --- a/cuML/src/dbscan/labelling/runner.h +++ b/cuML/src/dbscan/labelling/runner.h @@ -16,7 +16,7 @@ #pragma once -#include "utils.h" +#include #include #include #include "naive.h" diff --git a/cuML/src/dbscan/runner.h b/cuML/src/dbscan/runner.h index eac8f6fa26..b9424c21ea 100644 --- a/cuML/src/dbscan/runner.h +++ b/cuML/src/dbscan/runner.h @@ -16,7 +16,7 @@ #pragma once -#include "utils.h" +#include #include "vertexdeg/runner.h" #include "adjgraph/runner.h" #include "labelling/runner.h" @@ -69,15 +69,15 @@ size_t run(Type_f* x, Type N, Type D, Type_f eps, Type minPts, Type* labels, cudaStream_t stream) { const size_t align = 256; int batchSize = ceildiv(N, nBatches); - size_t adjSize = alignSize(sizeof(bool) * N * batchSize, align); - size_t corePtsSize = alignSize(sizeof(bool) * N, align); - size_t visitedSize = alignSize(sizeof(bool) * N, align); - size_t xaSize = alignSize(sizeof(bool) * N, align); - size_t mSize = alignSize(sizeof(bool), align); - size_t vdSize = alignSize(sizeof(Type) * (batchSize + 1), align); - size_t exScanSize = alignSize(sizeof(Type) * batchSize, align); - size_t mapIdSize = alignSize(sizeof(Type) * N, align); - size_t dotsSize = alignSize(sizeof(Type_f) * N, align); + size_t adjSize = alignTo(sizeof(bool) * N * batchSize, align); + size_t corePtsSize = alignTo(sizeof(bool) * N, align); + size_t visitedSize = alignTo(sizeof(bool) * N, align); + size_t xaSize = alignTo(sizeof(bool) * N, align); + size_t mSize = alignTo(sizeof(bool), align); + size_t vdSize = alignTo(sizeof(Type) * (batchSize + 1), align); + size_t exScanSize = alignTo(sizeof(Type) * batchSize, align); + size_t mapIdSize = alignTo(sizeof(Type) * N, align); + size_t dotsSize = alignTo(sizeof(Type_f) * N, align); if(workspace == NULL) { auto size = adjSize + corePtsSize diff --git a/cuML/src/dbscan/vertexdeg/algo5.h b/cuML/src/dbscan/vertexdeg/algo5.h index 6269f949d1..eb955be9ef 100644 --- a/cuML/src/dbscan/vertexdeg/algo5.h +++ b/cuML/src/dbscan/vertexdeg/algo5.h @@ -17,7 +17,6 @@ #pragma once #include -#include "utils.h" #include "pack.h" #include "../common.h" #include diff --git a/cuML/src/utils.h b/cuML/src/utils.h deleted file mode 100644 index e5590b9ba4..0000000000 --- a/cuML/src/utils.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2018, NVIDIA CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -namespace Dbscan { - -#define THROW(fmt, ...) \ - do { \ - std::string msg; \ - char errMsg[2048]; \ - std::sprintf(errMsg, "Exception occured! file=%s line=%d: ", \ - __FILE__, __LINE__); \ - msg += errMsg; \ - std::sprintf(errMsg, fmt, ##__VA_ARGS__); \ - msg += errMsg; \ - throw std::runtime_error(msg); \ - } while(0) - -#define ASSERT(check, fmt, ...) \ - do { \ - if(!(check)) THROW(fmt, ##__VA_ARGS__); \ - } while(0) - - -template -IntType ceildiv(IntType a, IntType b) { - return ((a + b - 1) / b); -} - -template -IntType alignSize(IntType a, IntType b) { - return ceildiv(a,b)*b; -} - -} // namespace Dbscan