Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OSX compilation and rename checkAffinity to qmc-check-affinity #1107

Merged
merged 4 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/QMCTools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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-check-affinity check-affinity.cpp)

FOREACH(p ${QTOOLS})

Expand Down
18 changes: 16 additions & 2 deletions src/QMCTools/checkAffinity.cpp → src/QMCTools/check-affinity.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
//////////////////////////////////////////////////////////////////////////////////////
// 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 </bgsys/drivers/ppcfloor/spi/include/kernel/location.h>
#else
#elif __linux__
#include <sched.h>
#endif
#include <omp.h>
Expand All @@ -15,9 +26,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
}

Expand All @@ -36,6 +49,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();
Expand Down