Skip to content

Commit

Permalink
Merge pull request #1107 from ye-luo/fix-and-rename-checkAffinity
Browse files Browse the repository at this point in the history
Fix OSX compilation and rename checkAffinity to qmc-check-affinity
  • Loading branch information
prckent authored Oct 11, 2018
2 parents 3551a29 + 758fcda commit 9bafe2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
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

0 comments on commit 9bafe2a

Please sign in to comment.