Skip to content

Commit

Permalink
Merge branch 'oap-project:master' into random_forest
Browse files Browse the repository at this point in the history
  • Loading branch information
minmingzhu authored May 9, 2023
2 parents a4f1cd5 + e8ee55f commit 0554684
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 17 deletions.
6 changes: 5 additions & 1 deletion mllib-dal/src/main/native/CorrelationImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace covariance_cpu = daal::algorithms::covariance;

typedef double algorithmFPType; /* Algorithm floating-point type */

static void doCorrelationDaalCompute(JNIEnv *env, jobject obj, int rankId,
static void doCorrelationDaalCompute(JNIEnv *env, jobject obj, size_t rankId,
ccl::communicator &comm,
const NumericTablePtr &pData,
size_t nBlocks, jobject resultObj) {
Expand Down Expand Up @@ -235,6 +235,10 @@ Java_com_intel_oap_mllib_stat_CorrelationDALImpl_cCorrelationTrainDAL(
break;
}
#endif
default: {
std::cout << "no supported device!" << std::endl;
exit(-1);
}
}
return 0;
}
8 changes: 6 additions & 2 deletions mllib-dal/src/main/native/KMeansImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace kmeans_cpu = daal::algorithms::kmeans;

typedef double algorithmFPType; /* Algorithm floating-point type */

static NumericTablePtr kmeans_compute(int rankId, ccl::communicator &comm,
static NumericTablePtr kmeans_compute(size_t rankId, ccl::communicator &comm,
const NumericTablePtr &pData,
const NumericTablePtr &initialCentroids,
size_t nClusters, size_t nBlocks,
Expand Down Expand Up @@ -174,7 +174,7 @@ static bool areAllCentersConverged(const NumericTablePtr &oldCenters,
return true;
}

static jlong doKMeansDaalCompute(JNIEnv *env, jobject obj, int rankId,
static jlong doKMeansDaalCompute(JNIEnv *env, jobject obj, size_t rankId,
ccl::communicator &comm,
NumericTablePtr &pData,
NumericTablePtr &centroids, jint cluster_num,
Expand Down Expand Up @@ -354,6 +354,10 @@ Java_com_intel_oap_mllib_clustering_KMeansDALImpl_cKMeansOneapiComputeWithInitCe
break;
}
#endif
default: {
std::cout << "no supported device!" << std::endl;
exit(-1);
}
}
return ret;
}
8 changes: 4 additions & 4 deletions mllib-dal/src/main/native/LinearRegressionImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace ridge_regression_cpu = daal::algorithms::ridge_regression;

typedef double algorithmFPType; /* Algorithm floating-point type */

static NumericTablePtr linear_regression_compute(int rankId,
static NumericTablePtr linear_regression_compute(size_t rankId,
ccl::communicator &comm,
const NumericTablePtr &pData,
const NumericTablePtr &pLabel,
Expand Down Expand Up @@ -126,7 +126,7 @@ static NumericTablePtr linear_regression_compute(int rankId,
}

static NumericTablePtr ridge_regression_compute(
int rankId, ccl::communicator &comm, const NumericTablePtr &pData,
size_t rankId, ccl::communicator &comm, const NumericTablePtr &pData,
const NumericTablePtr &pLabel, double regParam, size_t nBlocks) {

using daal::byte;
Expand Down Expand Up @@ -213,7 +213,7 @@ static NumericTablePtr ridge_regression_compute(
}

#ifdef CPU_GPU_PROFILE
static jlong doLROneAPICompute(JNIEnv *env, int rankId,
static jlong doLROneAPICompute(JNIEnv *env, size_t rankId,
ccl::communicator &cclComm, sycl::queue &queue,
jlong pData, jlong pLabel, jint executorNum,
jobject resultObj) {
Expand Down Expand Up @@ -262,7 +262,7 @@ Java_com_intel_oap_mllib_regression_LinearRegressionDALImpl_cLinearRegressionTra
<< std::endl;

ccl::communicator &cclComm = getComm();
int rankId = cclComm.rank();
size_t rankId = cclComm.rank();

ComputeDevice device = getComputeDeviceByOrdinal(computeDeviceOrdinal);
bool useGPU = false;
Expand Down
2 changes: 1 addition & 1 deletion mllib-dal/src/main/native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $(info )
$(info === Profile is $(PLATFORM_PROFILE) ===)
$(info )

CFLAGS_COMMON := -g -Wall -Wno-deprecated-declarations -fPIC -std=c++17 \
CFLAGS_COMMON := -Wall -Wno-deprecated-declarations -fPIC -std=c++17 \
-I $(I_MPI_ROOT)/include \
-I $(DAALROOT)/include \
-I $(CCL_ROOT)/include/cpu/oneapi/ \
Expand Down
6 changes: 3 additions & 3 deletions mllib-dal/src/main/native/NaiveBayesDALImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ trainModel(const ccl::communicator &comm, const NumericTablePtr &featuresTab,
Profiler profiler("NaiveBayes");
#endif

auto rankId = comm.rank();
auto nBlocks = comm.size();
size_t rankId = comm.rank();
size_t nBlocks = comm.size();

/* Create an algorithm object to train the Naive Bayes model based on the
* local-node data */
Expand Down Expand Up @@ -127,7 +127,7 @@ Java_com_intel_oap_mllib_classification_NaiveBayesDALImpl_cNaiveBayesDALCompute(
jint class_num, jint executor_num, jint executor_cores, jobject resultObj) {

ccl::communicator &comm = getComm();
auto rankId = comm.rank();
size_t rankId = comm.rank();

NumericTablePtr featuresTab = *((NumericTablePtr *)pFeaturesTab);
NumericTablePtr labelsTab = *((NumericTablePtr *)pLabelsTab);
Expand Down
2 changes: 1 addition & 1 deletion mllib-dal/src/main/native/OneCCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "OneCCL.h"
#include "com_intel_oap_mllib_OneCCL__.h"

extern const int ccl_root = 0;
extern const size_t ccl_root = 0;

static const int CCL_IP_LEN = 128;
static std::list<std::string> local_host_ips;
Expand Down
2 changes: 1 addition & 1 deletion mllib-dal/src/main/native/OneCCL.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ event CCL_API gather(const BufferType *sendbuf, int sendcount,

ccl::communicator &getComm();
ccl::shared_ptr_class<ccl::kvs> &getKvs();
extern const int ccl_root;
extern const size_t ccl_root;
10 changes: 7 additions & 3 deletions mllib-dal/src/main/native/PCAImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ namespace covariance_cpu = daal::algorithms::covariance;

typedef double algorithmFPType; /* Algorithm floating-point type */

static void doPCADAALCompute(JNIEnv *env, jobject obj, int rankId,
static void doPCADAALCompute(JNIEnv *env, jobject obj, size_t rankId,
ccl::communicator &comm, NumericTablePtr &pData,
int nBlocks, jobject resultObj) {
size_t nBlocks, jobject resultObj) {
std::cout << "oneDAL (native): CPU compute start" << std::endl;
using daal::byte;
auto t1 = std::chrono::high_resolution_clock::now();
Expand Down Expand Up @@ -252,7 +252,7 @@ Java_com_intel_oap_mllib_feature_PCADALImpl_cPCATrainDAL(
<< "; device " << ComputeDeviceString[computeDeviceOrdinal]
<< std::endl;
ccl::communicator &cclComm = getComm();
int rankId = cclComm.rank();
size_t rankId = cclComm.rank();
ComputeDevice device = getComputeDeviceByOrdinal(computeDeviceOrdinal);
switch (device) {
case ComputeDevice::host:
Expand Down Expand Up @@ -292,6 +292,10 @@ Java_com_intel_oap_mllib_feature_PCADALImpl_cPCATrainDAL(
break;
}
#endif
default: {
std::cout << "no supported device!" << std::endl;
exit(-1);
}
}
return 0;
}
6 changes: 5 additions & 1 deletion mllib-dal/src/main/native/SummarizerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ using namespace daal::services;

typedef double algorithmFPType; /* Algorithm floating-point type */

static void doSummarizerDAALCompute(JNIEnv *env, jobject obj, int rankId,
static void doSummarizerDAALCompute(JNIEnv *env, jobject obj, size_t rankId,
ccl::communicator &comm,
const NumericTablePtr &pData,
size_t nBlocks, jobject resultObj) {
Expand Down Expand Up @@ -304,6 +304,10 @@ Java_com_intel_oap_mllib_stat_SummarizerDALImpl_cSummarizerTrainDAL(
break;
}
#endif
default: {
std::cout << "no supported device!" << std::endl;
exit(-1);
}
}
return 0;
}

0 comments on commit 0554684

Please sign in to comment.