Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
argentea committed Jul 10, 2023
1 parent 59219ec commit a25c586
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
16 changes: 10 additions & 6 deletions mllib-dal/src/main/native/OneCCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

#include <oneapi/ccl.hpp>

#include "Logger.h"
#include "OneCCL.h"
#include "com_intel_oap_mllib_OneCCL__.h"
#include "Logger.h"

extern const size_t ccl_root = 0;

Expand All @@ -49,7 +49,6 @@ JNIEXPORT jint JNICALL Java_com_intel_oap_mllib_OneCCL_00024_c_1init(
jobject param) {

logger::printerrln(logger::INFO, "OneCCL (native): init");


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

Expand All @@ -70,7 +69,8 @@ JNIEXPORT jint JNICALL Java_com_intel_oap_mllib_OneCCL_00024_c_1init(
auto t2 = std::chrono::high_resolution_clock::now();
auto duration =
std::chrono::duration_cast<std::chrono::seconds>(t2 - t1).count();
logger::printerrln(logger::INFO, "OneCCL (native): init took %d secs", duration);
logger::printerrln(logger::INFO, "OneCCL (native): init took %d secs",
duration);

rank_id = getComm().rank();
comm_size = getComm().size();
Expand Down Expand Up @@ -136,7 +136,8 @@ static int fill_local_host_ip() {
int family = AF_UNSPEC;
char local_ip[CCL_IP_LEN];
if (getifaddrs(&ifaddr) < 0) {
logger::printerrln(logger::ERROR, "OneCCL (native): can not get host IP");
logger::printerrln(logger::ERROR,
"OneCCL (native): can not get host IP");
return -1;
}

Expand Down Expand Up @@ -166,7 +167,9 @@ static int fill_local_host_ip() {
}
}
if (local_host_ips.empty()) {
logger::printerrln(logger::ERROR, "OneCCL (native): can't find interface to get host IP");
logger::printerrln(
logger::ERROR,
"OneCCL (native): can't find interface to get host IP");
return -1;
}

Expand All @@ -177,7 +180,8 @@ static int fill_local_host_ip() {

static bool is_valid_ip(char ip[]) {
if (fill_local_host_ip() == -1) {
logger::printerrln(logger::ERROR, "OneCCL (native): get local host ip error");
logger::printerrln(logger::ERROR,
"OneCCL (native): get local host ip error");
return false;
};

Expand Down
36 changes: 24 additions & 12 deletions mllib-dal/src/main/native/service.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "service.h"
#include "error_handling.h"
#include "Logger.h"
#include "error_handling.h"

using namespace daal;
using namespace daal::data_management;
Expand Down Expand Up @@ -181,7 +181,9 @@ void printAprioriItemsets(NumericTablePtr largeItemsetsTable,
for (size_t l = 0; l < largeItemsetsVector[i].size() - 1; l++) {
logger::print(logger::NONE, "%d, ", largeItemsetsVector[i][l]);
}
logger::print(logger::NONE, "%d}\t\t", largeItemsetsVector[i][largeItemsetsVector[i].size() - 1]);
logger::print(
logger::NONE, "%d}\t\t",
largeItemsetsVector[i][largeItemsetsVector[i].size() - 1]);

logger::println(logger::NONE, "%d", supportVector[i]);
}
Expand Down Expand Up @@ -252,12 +254,14 @@ void printAprioriRules(NumericTablePtr leftItemsTable,
for (size_t l = 0; l < leftItemsVector[i].size() - 1; l++) {
logger::print(logger::NONE, "%d, ", leftItemsVector[i][l]);
}
logger::print(logger::NONE, "%d} => {", leftItemsVector[i][leftItemsVector[i].size() - 1]);
logger::print(logger::NONE, "%d} => {",
leftItemsVector[i][leftItemsVector[i].size() - 1]);

for (size_t l = 0; l < rightItemsVector[i].size() - 1; l++) {
logger::print(logger::NONE, "%d, ", rightItemsVector[i][l]);
}
logger::print(logger::NONE, "%d}\t\t", rightItemsVector[i][rightItemsVector[i].size() - 1]);
logger::print(logger::NONE, "%d}\t\t",
rightItemsVector[i][rightItemsVector[i].size() - 1]);

logger::println(logger::NONE, "%d", confidenceVector[i]);
}
Expand Down Expand Up @@ -299,7 +303,8 @@ void printArray(T *array, const size_t nPrintedCols, const size_t nPrintedRows,
for (size_t i = 0; i < nPrintedRows; i++) {
logger::print(logger::INFO, "");
for (size_t j = 0; j < nPrintedCols; j++) {
logger::print(logger::NONE, "%*.3f", interval, array[i * nCols + j]);
logger::print(logger::NONE, "%*.3f", interval,
array[i * nCols + j]);
}
logger::println(logger::NONE, "");
}
Expand Down Expand Up @@ -461,10 +466,12 @@ void printNumericTables(NumericTable *dataTable1, NumericTable *dataTable2,
for (size_t i = 0; i < nRows; i++) {
logger::print(logger::INFO, "");
for (size_t j = 0; j < nCols1; j++) {
logger::print(logger::NONE, "%*.3f", interval, data1[i * nCols1 + j]);
logger::print(logger::NONE, "%*.3f", interval,
data1[i * nCols1 + j]);
}
for (size_t j = 0; j < nCols2; j++) {
logger::print(logger::NONE, "%*.0f", interval, data2[i * nCols2 + j]);
logger::print(logger::NONE, "%*.0f", interval,
data2[i * nCols2 + j]);
}
logger::println(logger::NONE, "");
}
Expand Down Expand Up @@ -512,10 +519,12 @@ void printNumericTables(NumericTable *dataTable1, NumericTable *dataTable2,
for (size_t i = 0; i < nRows; i++) {
logger::print(logger::INFO, "");
for (size_t j = 0; j < nCols1; j++) {
logger::print(logger::NONE, "%*.3f", interval, data1[i * nCols1 + j]);
logger::print(logger::NONE, "%*.3f", interval,
data1[i * nCols1 + j]);
}
for (size_t j = 0; j < nCols2; j++) {
logger::print(logger::NONE, "%*.0f", interval, data2[i * nCols2 + j]);
logger::print(logger::NONE, "%*.0f", interval,
data2[i * nCols2 + j]);
}
logger::println(logger::NONE, "");
}
Expand Down Expand Up @@ -580,7 +589,8 @@ void checkArguments(int argc, char *argv[], int count, ...) {
(*filelist[i]) = argv[i + 1];
}
} else {
logger::println(logger::WARN, "Warning: Try to open default datasetFileNames");
logger::println(logger::WARN,
"Warning: Try to open default datasetFileNames");
for (int i = 0; i < count; i++) {
checkFileIsAvailable(*(filelist[i]), true);
}
Expand All @@ -591,7 +601,8 @@ void checkArguments(int argc, char *argv[], int count, ...) {
logger::print(logger::NONE, "<filename_%d>", i);
}
logger::println(logger::NONE, "]");
logger::println(logger::WARN, "Warning: Try to open default datasetFileNames");
logger::println(logger::WARN,
"Warning: Try to open default datasetFileNames");
for (int i = 0; i < count; i++) {
checkFileIsAvailable(*(filelist[i]), true);
}
Expand Down Expand Up @@ -707,7 +718,8 @@ void printALSRatings(NumericTablePtr usersOffsetTable,
logger::println(logger::INFO, " User ID, Item ID, rating");
for (size_t i = 0; i < nUsers; i++) {
for (size_t j = 0; j < nItems; j++) {
logger::println(logger::INFO, "%d, %d, %d", i + usersOffset, j + itemsOffset, ratingsData[i * nItems + j]);
logger::println(logger::INFO, "%d, %d, %d", i + usersOffset,
j + itemsOffset, ratingsData[i * nItems + j]);
}
}
ratings->releaseBlockOfRows(block1);
Expand Down

0 comments on commit a25c586

Please sign in to comment.