Skip to content

Commit

Permalink
[SuperLU_DIST] Add patch for Windows and use LLVM OpenMP for BSD systems
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano committed May 4, 2022
1 parent d6271c9 commit 1c4a4b2
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 9 deletions.
20 changes: 11 additions & 9 deletions S/SuperLU_DIST/build_tarballs.jl
Expand Up @@ -10,15 +10,18 @@ sources = [
# We are using the most recent master as of this build rather than v7.2.0 release.
# The release is strangely missing .h files that are necessary for build.
# They exist on master.
GitSource("https://github.com/xiaoyeli/superlu_dist.git", "b430c074a19bdfd897d5e2a285a85bc819db12e5")
GitSource("https://github.com/xiaoyeli/superlu_dist.git", "b430c074a19bdfd897d5e2a285a85bc819db12e5"),
DirectorySource("./bundled"),
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/superlu_dist*
atomic_patch -p1 ../patches/0001-Removing-getFreq-was-used-with-timestamp-counters-on.patch
mkdir build && cd build
# This is required to ensure that MSMPI can be found by cmake
if [[ "${target}" == *-mingw* ]]; then
# This is required to ensure that MSMPI can be found by cmake
export LDFLAGS="-L${libdir} -lmsmpi"
PLATFLAGS="-DTPL_ENABLE_PARMETISLIB:BOOL=FALSE -DMPI_C_ADDITIONAL_INCLUDE_DIRS=${includedir}"
else
Expand All @@ -44,17 +47,13 @@ cmake -DCMAKE_INSTALL_PREFIX=${prefix} \
..
make -j${nproc}
make install
if [[ "${target}" == *-mingw* ]]; then
# Manually install the library
install -Dvm 0755 "SRC/libsuperlu.${dlext}" "${libdir}/libsuperlu.${dlext}"
fi
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
# Excluding Windows due to use of `getline` function, which is non-standard and not provided by MinGW
# per Mose. Will return to it later and attempt to find a solution.
platforms = expand_gfortran_versions(supported_platforms(; exclude=Sys.iswindows))
platforms = expand_gfortran_versions(supported_platforms())
platforms = filter(p -> libgfortran_version(p) v"3", platforms)
# The products that we will ensure are always built
products = [
Expand All @@ -66,9 +65,12 @@ dependencies = [
Dependency(PackageSpec(name="OpenBLAS32_jll", uuid="656ef2d0-ae68-5445-9ca0-591084a874a2")),
Dependency(PackageSpec(name="PARMETIS_jll", uuid="b247a4be-ddc1-5759-8008-7e02fe3dbdaa"); platforms=filter(!Sys.iswindows, platforms)),
Dependency("MPICH_jll"; platforms=filter(!Sys.iswindows, platforms)),
# Dependency(PackageSpec(name="MicrosoftMPI_jll"); platforms=filter(Sys.iswindows, platforms)),
Dependency("MicrosoftMPI_jll"; platforms=filter(Sys.iswindows, platforms)),
Dependency("METIS_jll"),
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"))
# For OpenMP we use libomp from `LLVMOpenMP_jll` where we use LLVM as compiler (BSD
# systems), and libgomp from `CompilerSupportLibraries_jll` everywhere else.
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"); platforms=filter(!Sys.isbsd, platforms)),
Dependency(PackageSpec(name="LLVMOpenMP_jll", uuid="1d63c593-3942-5779-bab2-d838dc0a180e"); platforms=filter(Sys.isbsd, platforms)),
]

# Build the tarballs, and possibly a `build.jl` as well.
Expand Down
@@ -0,0 +1,97 @@
From f7bf3d9769b98d8206b69e0505648cf1c49a6f7e Mon Sep 17 00:00:00 2001
From: Piyush Sao <saopk@ornl.gov>
Date: Wed, 4 May 2022 12:44:23 -0400
Subject: [PATCH 1/1] Removing getFreq(); was used with timestamp counters only
on intel machines

---
SRC/sec_structs.c | 20 +++++++++++---------
SRC/superlu_defs.h | 2 +-
2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/SRC/sec_structs.c b/SRC/sec_structs.c
index 0f2e2a5..ce2bc7a 100644
--- a/SRC/sec_structs.c
+++ b/SRC/sec_structs.c
@@ -36,7 +36,7 @@ at the top-level directory.
#include <stdio.h> /*for printfs*/
#include <stdlib.h> /*for getline*/

-double CPU_CLOCK_RATE;
+// double CPU_CLOCK_RATE;
/*for sorting structures */
int Cmpfunc_R_info (const void * a, const void * b)
{
@@ -108,7 +108,7 @@ double *SCT_ThreadVarInit(int_t num_threads)
return var;
}

-
+#if 0
#define DEFAULT_CPU_FREQ 3000.0 // 3 GHz

double getFreq(void)
@@ -161,11 +161,13 @@ double getFreq(void)
return 0;
}

+#endif
+
/* Initialize various counters. */
void SCT_init(SCT_t* SCT)
{
#if 1
- CPU_CLOCK_RATE = getFreq() * 1e-3;
+ // CPU_CLOCK_RATE = getFreq() * 1e-3;
#else
CPU_CLOCK_RATE = 3000. * 1e-3;
#endif
@@ -443,7 +445,7 @@ void SCT_print(gridinfo_t *grid, SCT_t* SCT)
}
}
#endif
- CPU_CLOCK_RATE = 1e9 * CPU_CLOCK_RATE;
+ // CPU_CLOCK_RATE = 1e9 * CPU_CLOCK_RATE;

int iam = grid->iam;
int_t num_procs = grid->npcol * grid->nprow;
@@ -451,7 +453,7 @@ void SCT_print(gridinfo_t *grid, SCT_t* SCT)
MPI_Reduce( &SCT->NetSchurUpTimer, &temp_holder, 1, MPI_DOUBLE, MPI_SUM, 0, grid->comm );
if (!iam)
{
- printf("CPU_CLOCK_RATE %.1f\n", CPU_CLOCK_RATE );
+ // printf("CPU_CLOCK_RATE %.1f\n", CPU_CLOCK_RATE );
printf("Total time in factorization \t: %5.2lf\n", SCT->pdgstrfTimer);
printf("MPI-communication phase \t: %5.2lf\n", SCT->pdgstrfTimer - (temp_holder / num_procs));

@@ -473,10 +475,10 @@ void SCT_print(gridinfo_t *grid, SCT_t* SCT)

// DistPrint("Bcast_UPanel ", SCT->Bcast_UPanel_tl / CPU_CLOCK_RATE, "Seconds", grid);
// DistPrint("Bcast_LPanel ", SCT->Bcast_LPanel_tl / CPU_CLOCK_RATE, "Seconds", grid);
- DistPrint("Wait_LSend ", SCT->Wait_LSend_tl / CPU_CLOCK_RATE, "Seconds", grid);
- DistPrint("Wait_USend ", SCT->Wait_USend_tl / CPU_CLOCK_RATE, "Seconds", grid);
- DistPrint("Wait_URecv ", SCT->Wait_URecv_tl / CPU_CLOCK_RATE, "Seconds", grid);
- DistPrint("Wait_LRecv ", SCT->Wait_LRecv_tl / CPU_CLOCK_RATE, "Seconds", grid);
+ DistPrint("Wait_LSend ", SCT->Wait_LSend_tl , "Seconds", grid);
+ DistPrint("Wait_USend ", SCT->Wait_USend_tl , "Seconds", grid);
+ DistPrint("Wait_URecv ", SCT->Wait_URecv_tl , "Seconds", grid);
+ DistPrint("Wait_LRecv ", SCT->Wait_LRecv_tl , "Seconds", grid);
DistPrint("L_PanelUpdate ", SCT->L_PanelUpdate_tl , "Seconds", grid);
DistPrint("PDGSTRS2 ", SCT->PDGSTRS2_tl , "Seconds", grid);

diff --git a/SRC/superlu_defs.h b/SRC/superlu_defs.h
index 0eeca79..a296744 100644
--- a/SRC/superlu_defs.h
+++ b/SRC/superlu_defs.h
@@ -887,7 +887,7 @@ typedef struct


//global variable
-extern double CPU_CLOCK_RATE;
+// extern double CPU_CLOCK_RATE;

typedef struct
{
--
2.36.0

0 comments on commit 1c4a4b2

Please sign in to comment.