Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
argentea committed Jul 21, 2023
1 parent caa60c2 commit 867f9b6
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 29 deletions.
20 changes: 10 additions & 10 deletions mllib-dal/src/main/native/ALSDALImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void initializeModel(size_t rankId, ccl::communicator &comm, size_t partitionId,
auto duration =
std::chrono::duration_cast<std::chrono::seconds>(t2 - t1).count();
logger::println(logger::INFO, "ALS (native): initializeModel took %d secs",
duration);
duration);
}

training::DistributedPartialResultStep1Ptr computeStep1Local(
Expand Down Expand Up @@ -426,14 +426,14 @@ void trainModel(size_t rankId, ccl::communicator &comm, size_t partitionId,
auto duration =
std::chrono::duration_cast<std::chrono::seconds>(t2 - t1).count();
logger::println(logger::INFO, "ALS (native): iteration %d took %f secs",
iteration, duration);
iteration, duration);
}

auto tEnd = std::chrono::high_resolution_clock::now();
auto durationTotal =
std::chrono::duration_cast<std::chrono::seconds>(tEnd - tStart).count();
logger::println(logger::INFO, "ALS (native): trainModel took %d secs",
durationTotal);
durationTotal);
}

static size_t getOffsetFromOffsetTable(NumericTablePtr offsetTable) {
Expand Down Expand Up @@ -497,11 +497,11 @@ Java_com_intel_oap_mllib_recommendation_ALSDALImpl_cDALImplictALS(

logger::println(logger::INFO, "ALS (native): Input info:");
logger::println(logger::INFO, "- NumberOfRows: %d",
dataTable->getNumberOfRows());
dataTable->getNumberOfRows());
logger::println(logger::INFO, "- NumberOfColumns: %d",
dataTable->getNumberOfColumns());
dataTable->getNumberOfColumns());
logger::println(logger::INFO, "- NumberOfRatings: %d",
dataTable->getDataSize());
dataTable->getDataSize());
logger::println(logger::INFO, "- fullNUsers: %d", nUsers);
logger::println(logger::INFO, "- nFactors: %d", nFactors);

Expand All @@ -510,8 +510,8 @@ Java_com_intel_oap_mllib_recommendation_ALSDALImpl_cDALImplictALS(
int nThreadsNew =
services::Environment::getInstance()->getNumberOfThreads();
logger::println(logger::INFO,
"oneDAL (native): Number of CPU threads used: %d",
nThreadsNew);
"oneDAL (native): Number of CPU threads used: %d",
nThreadsNew);

int nBlocks = executor_num;
initializeModel(rankId, comm, partitionId, nBlocks, nUsers, nFactors);
Expand All @@ -530,9 +530,9 @@ Java_com_intel_oap_mllib_recommendation_ALSDALImpl_cDALImplictALS(
printNumericTable(pItem, "Item Factors (first 10 rows x 20 columns):", 10,
20);
logger::println(logger::INFO, "User Offset: %d",
getOffsetFromOffsetTable(userOffset));
getOffsetFromOffsetTable(userOffset));
logger::println(logger::INFO, "Item Offset: %d",
getOffsetFromOffsetTable(itemOffset));
getOffsetFromOffsetTable(itemOffset));
logger::println(logger::INFO, "");

// Get the class of the input object
Expand Down
2 changes: 1 addition & 1 deletion mllib-dal/src/main/native/ALSShuffle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Rating *shuffle_all2all(ccl::communicator &comm,
newCsrRowNum = distinct_count(recvData);

logger::println(logger::INFO, "newRatingsNum: %d, newCsrRowNum: %d",
newRatingsNum, newCsrRowNum);
newRatingsNum, newCsrRowNum);

return recvData.data();
}
20 changes: 10 additions & 10 deletions mllib-dal/src/main/native/CorrelationImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ static void doCorrelationDaalCompute(JNIEnv *env, jobject obj, size_t rankId,
auto duration =
std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1).count();
logger::println(logger::INFO,
"Correleation (native): local step took %d secs",
duration / 1000);
"Correleation (native): local step took %d secs",
duration / 1000);

t1 = std::chrono::high_resolution_clock::now();

Expand All @@ -86,8 +86,8 @@ static void doCorrelationDaalCompute(JNIEnv *env, jobject obj, size_t rankId,
duration =
std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1).count();
logger::println(logger::INFO,
"Correleation (native): ccl_allgatherv took %d secs",
duration / 1000);
"Correleation (native): ccl_allgatherv took %d secs",
duration / 1000);
if (isRoot) {
auto t1 = std::chrono::high_resolution_clock::now();
/* Create an algorithm to compute covariance on the master node */
Expand Down Expand Up @@ -126,8 +126,8 @@ static void doCorrelationDaalCompute(JNIEnv *env, jobject obj, size_t rankId,
std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1)
.count();
logger::println(logger::INFO,
"Correleation (native): master step took %d secs",
duration / 1000);
"Correleation (native): master step took %d secs",
duration / 1000);

/* Print the results */
printNumericTable(result->get(covariance_cpu::correlation),
Expand Down Expand Up @@ -200,8 +200,8 @@ Java_com_intel_oap_mllib_stat_CorrelationDALImpl_cCorrelationTrainDAL(
jint executorCores, jint computeDeviceOrdinal, jintArray gpuIdxArray,
jobject resultObj) {
logger::println(logger::INFO,
"oneDAL (native): use DPC++ kernels; device %s",
ComputeDeviceString[computeDeviceOrdinal].c_str());
"oneDAL (native): use DPC++ kernels; device %s",
ComputeDeviceString[computeDeviceOrdinal].c_str());

ccl::communicator &cclComm = getComm();
int rankId = cclComm.rank();
Expand All @@ -216,8 +216,8 @@ Java_com_intel_oap_mllib_stat_CorrelationDALImpl_cCorrelationTrainDAL(
int nThreadsNew =
services::Environment::getInstance()->getNumberOfThreads();
logger::println(logger::INFO,
"oneDAL (native): Number of CPU threads used %d",
nThreadsNew);
"oneDAL (native): Number of CPU threads used %d",
nThreadsNew);
doCorrelationDaalCompute(env, obj, rankId, cclComm, pData, executorNum,
resultObj);
break;
Expand Down
2 changes: 1 addition & 1 deletion mllib-dal/src/main/native/LinearRegressionImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static jlong doLROneAPICompute(JNIEnv *env, size_t rankId,
jboolean jfitIntercept, jint executorNum,
jobject resultObj) {
logger::println(logger::INFO,
"oneDAL (native): GPU compute start , rankid %d", rankId);
"oneDAL (native): GPU compute start , rankid %d", rankId);
const bool isRoot = (rankId == ccl_root);
bool fitIntercept = bool(jfitIntercept);

Expand Down
18 changes: 11 additions & 7 deletions mllib-dal/src/main/native/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,24 +813,28 @@ void printHomegenTable(const oneapi::dal::table &table) {
if (table.get_row_count() <= 10) {
for (std::int64_t i = 0; i < table.get_row_count(); i++) {
for (std::int64_t j = 0; j < table.get_column_count(); j++) {
logger::print(logger::INFO, "%10f", x[i * table.get_column_count() + j]);
logger::print(logger::INFO, "%10f",
x[i * table.get_column_count() + j]);
}
logger::println("");
logger::println("");
}
} else {
for (std::int64_t i = 0; i < 5; i++) {
for (std::int64_t j = 0; j < table.get_column_count(); j++) {
logger::print(logger::INFO, "%10f", x[i * table.get_column_count() + j]);
logger::print(logger::INFO, "%10f",
x[i * table.get_column_count() + j]);
}
logger::println("");
logger::println("");
}
logger::println(logger::INFO, "...%ld lines skipped...", (table.get_row_count() - 10));
logger::println(logger::INFO, "...%ld lines skipped...",
(table.get_row_count() - 10));
for (std::int64_t i = table.get_row_count() - 5;
i < table.get_row_count(); i++) {
for (std::int64_t j = 0; j < table.get_column_count(); j++) {
logger::print(logger::INFO, "%10f", x[i * table.get_column_count() + j]);
logger::print(logger::INFO, "%10f",
x[i * table.get_column_count() + j]);
}
logger::println("");
logger::println("");
}
}
return 0;
Expand Down

0 comments on commit 867f9b6

Please sign in to comment.