diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 687ffcd..9115483 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -2,13 +2,13 @@ name: Linux Build and Test on: push: - branches: + branches: - master + - Fix-build - Fix-ci/cd-pipeline pull_request: - branches: + branches: - master - - Fix-ci/cd-pipeline jobs: build: diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index 490da1f..3bc584e 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -4,11 +4,11 @@ on: push: branches: - master + - Fix-build - Fix-ci/cd-pipeline pull_request: branches: - master - - Fix-ci/cd-pipeline jobs: build: diff --git a/src/vonmises/lib.py b/src/vonmises/lib.py index 687004b..4e85dd7 100644 --- a/src/vonmises/lib.py +++ b/src/vonmises/lib.py @@ -13,17 +13,18 @@ """ import ctypes +import os import sys from pathlib import Path -sys_version = f"{sys.version_info.major}{sys.version_info.minor}" if sys.platform == "win32": shared_file_path = Path( sys.prefix, "bin", "libvonmises.dll", ) + os.add_dll_directory(str(shared_file_path)) vonmises_lib = ctypes.CDLL(str(shared_file_path), winmode=0) elif sys.platform == "linux": shared_file_path = Path(sys.prefix, "lib", "libvonmises.so") diff --git a/src/vonmiseslib/logger.h b/src/vonmiseslib/logger.h index aaee9ec..3d89098 100644 --- a/src/vonmiseslib/logger.h +++ b/src/vonmiseslib/logger.h @@ -21,10 +21,10 @@ #include #endif -#define DEBUG(msg, ...) fmt::print(__TIME__ ": DEBUG : " msg "\n", ##__VA_ARGS__) -#define INFO(msg, ...) fmt::print(__TIME__ ": INFO : " msg "\n", ##__VA_ARGS__) -#define WARNING(msg, ...) fmt::print(__TIME__ ": WARNING : " msg "\n", ##__VA_ARGS__) -#define ERROR(msg, ...) fmt::print(__TIME__ ": ERROR : " msg "\n", ##__VA_ARGS__) +#define DEBUG_OUT(msg, ...) fmt::print(__TIME__ ": DEBUG : " msg "\n", ##__VA_ARGS__) +#define INFO_OUT(msg, ...) fmt::print(__TIME__ ": INFO : " msg "\n", ##__VA_ARGS__) +#define WARNING_OUT(msg, ...) fmt::print(__TIME__ ": WARNING : " msg "\n", ##__VA_ARGS__) +#define ERROR_OUT(msg, ...) fmt::print(__TIME__ ": ERROR : " msg "\n", ##__VA_ARGS__) using namespace std; diff --git a/src/vonmiseslib/rayleigh_quotient.cpp b/src/vonmiseslib/rayleigh_quotient.cpp index d9efc51..6303f46 100644 --- a/src/vonmiseslib/rayleigh_quotient.cpp +++ b/src/vonmiseslib/rayleigh_quotient.cpp @@ -17,11 +17,11 @@ double rayleighQuotient(const MatrixXd& A, const VectorXd& x) { - INFO("Calculating eigenvalue using Rayleigh Quotient ..."); + INFO_OUT("Calculating eigenvalue using Rayleigh Quotient ..."); double k = (A * x).dot(x) / x.dot(x); - DEBUG("Eigenvalue: {}", k); + DEBUG_OUT("Eigenvalue: {}", k); return k; } diff --git a/src/vonmiseslib/vonMises_API.cpp b/src/vonmiseslib/vonMises_API.cpp index b7212fc..4d3eab3 100644 --- a/src/vonmiseslib/vonMises_API.cpp +++ b/src/vonmiseslib/vonMises_API.cpp @@ -21,21 +21,21 @@ */ void solveEigenValueProblem(double** A, size_t size, double* eigenvalues, double** eigenvectors) { - INFO("----------------------------------------------"); - INFO("CMake Version :: {}", CMake_VERSION); - INFO("GCC Version :: {}", gcc_VERSION); - INFO("OMP max threads :: {}", omp_get_max_threads()); - INFO("----------------------------------------------"); + INFO_OUT("----------------------------------------------"); + INFO_OUT("CMake Version :: {}", CMake_VERSION); + INFO_OUT("GCC Version :: {}", gcc_VERSION); + INFO_OUT("OMP max threads :: {}", omp_get_max_threads()); + INFO_OUT("----------------------------------------------"); MatrixXd _A = convertToEigenMatrix(A, size); // Power Iteration with Deflation for (size_t a = 0; a < size; a++) { double start_time = clocktime(); VectorXd x = vonMisesIterationMethod(_A); - DEBUG("Execution time for Von Mises Method: {} seconds", deltaTime(start_time)); + DEBUG_OUT("Execution time for Von Mises Method: {} seconds", deltaTime(start_time)); start_time = clocktime(); double c = rayleighQuotient(_A, x); - DEBUG("Execution time for Rayleigh Quotient Method: {} seconds", deltaTime(start_time)); + DEBUG_OUT("Execution time for Rayleigh Quotient Method: {} seconds", deltaTime(start_time)); // Store the computed eigenvalue eigenvalues[a] = c; diff --git a/src/vonmiseslib/von_mises.cpp b/src/vonmiseslib/von_mises.cpp index 48caa26..e0ffe1f 100644 --- a/src/vonmiseslib/von_mises.cpp +++ b/src/vonmiseslib/von_mises.cpp @@ -18,8 +18,8 @@ VectorXd vonMisesIterationMethod(const MatrixXd& A) { - INFO("Starting Von Mises Method ..."); - INFO("Initializing random vector for Von Mises iteration ..."); + INFO_OUT("Starting Von Mises Method ..."); + INFO_OUT("Initializing random vector for Von Mises iteration ..."); int n = A.rows(); VectorXd x = VectorXd::Zero(n); @@ -49,7 +49,7 @@ VectorXd vonMisesIterationMethod(const MatrixXd& A) { double epsilon = (x - u).norm(); if (epsilon == 0 || epsilon < TOLERANCE) { - DEBUG("Dominant Eigenvector converged at {} iterations.", a); + DEBUG_OUT("Dominant Eigenvector converged at {} iterations.", a); return x; }