From 9786c9efdc666d5f14394c77936dd2f067c028d0 Mon Sep 17 00:00:00 2001 From: Ye Luo Date: Thu, 11 Oct 2018 15:01:23 -0500 Subject: [PATCH 1/4] Rename the binary to qmc-checkAffinity. --- src/QMCTools/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QMCTools/CMakeLists.txt b/src/QMCTools/CMakeLists.txt index 081f57d437..b7000347a0 100644 --- a/src/QMCTools/CMakeLists.txt +++ b/src/QMCTools/CMakeLists.txt @@ -42,7 +42,7 @@ ADD_LIBRARY(mocommon ${MOSRCS}) set(QTOOLS convert4qmc extract-eshdf-kvectors) ADD_EXECUTABLE(getSupercell getSupercell.cpp) -ADD_EXECUTABLE(checkAffinity checkAffinity.cpp) +ADD_EXECUTABLE(qmc-checkAffinity checkAffinity.cpp) FOREACH(p ${QTOOLS}) From 7e158fc70153dc8d464261fdc3cb67d48ad519f0 Mon Sep 17 00:00:00 2001 From: Ye Luo Date: Thu, 11 Oct 2018 15:01:48 -0500 Subject: [PATCH 2/4] Use sched_getcpu only on linux. --- src/QMCTools/checkAffinity.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/QMCTools/checkAffinity.cpp b/src/QMCTools/checkAffinity.cpp index 3d17d7bcf1..58bdab4886 100644 --- a/src/QMCTools/checkAffinity.cpp +++ b/src/QMCTools/checkAffinity.cpp @@ -1,6 +1,6 @@ #ifdef __bgq__ #include -#else +#elif __linux__ #include #endif #include @@ -15,9 +15,11 @@ int get_core() #ifdef __bgq__ int core = Kernel_ProcessorCoreID(); return core; -#else +#elif __linux__ int cpuid = sched_getcpu(); return cpuid; +#else + return -1; #endif } @@ -36,6 +38,7 @@ int get_hwthread() int main() { + std::cout << "Note: -1 means the property is not accessible on this platform." << std::endl << std::endl; #pragma omp parallel { int L1_thread_id = omp_get_thread_num(); From 4880625478cdd16001fffe92ade92667a89d11a2 Mon Sep 17 00:00:00 2001 From: Ye Luo Date: Thu, 11 Oct 2018 15:04:59 -0500 Subject: [PATCH 3/4] Add license header in checkAffinity.cpp --- src/QMCTools/checkAffinity.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/QMCTools/checkAffinity.cpp b/src/QMCTools/checkAffinity.cpp index 58bdab4886..83d251553c 100644 --- a/src/QMCTools/checkAffinity.cpp +++ b/src/QMCTools/checkAffinity.cpp @@ -1,3 +1,14 @@ +////////////////////////////////////////////////////////////////////////////////////// +// This file is distributed under the University of Illinois/NCSA Open Source License. +// See LICENSE file in top directory for details. +// +// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. +// +// File developed by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory +// +// File created by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory +////////////////////////////////////////////////////////////////////////////////////// + #ifdef __bgq__ #include #elif __linux__ From 758fcda3bf43004cacf59f6b99b0002fcee92f6e Mon Sep 17 00:00:00 2001 From: Ye Luo Date: Thu, 11 Oct 2018 16:13:54 -0500 Subject: [PATCH 4/4] Change binary name to qmc-check-affinity --- src/QMCTools/CMakeLists.txt | 2 +- src/QMCTools/{checkAffinity.cpp => check-affinity.cpp} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/QMCTools/{checkAffinity.cpp => check-affinity.cpp} (100%) diff --git a/src/QMCTools/CMakeLists.txt b/src/QMCTools/CMakeLists.txt index b7000347a0..f2360490a9 100644 --- a/src/QMCTools/CMakeLists.txt +++ b/src/QMCTools/CMakeLists.txt @@ -42,7 +42,7 @@ ADD_LIBRARY(mocommon ${MOSRCS}) set(QTOOLS convert4qmc extract-eshdf-kvectors) ADD_EXECUTABLE(getSupercell getSupercell.cpp) -ADD_EXECUTABLE(qmc-checkAffinity checkAffinity.cpp) +ADD_EXECUTABLE(qmc-check-affinity check-affinity.cpp) FOREACH(p ${QTOOLS}) diff --git a/src/QMCTools/checkAffinity.cpp b/src/QMCTools/check-affinity.cpp similarity index 100% rename from src/QMCTools/checkAffinity.cpp rename to src/QMCTools/check-affinity.cpp