Update the Windows paffinity component.
This commit was SVN r15027.
Этот коммит содержится в:
родитель
715f6012cf
Коммит
c2a18b0741
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "opal/mca/paffinity/paffinity.h"
|
#include "opal/mca/paffinity/paffinity.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global functions for MCA overall paffinity open and close
|
* Global functions for MCA overall paffinity open and close
|
||||||
*/
|
*/
|
||||||
|
@ -52,14 +52,14 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* Globally exported variable
|
* Globally exported variable
|
||||||
*/
|
*/
|
||||||
OPAL_MODULE_DECLSPEC extern const opal_paffinity_base_component_1_0_0_t
|
OPAL_MODULE_DECLSPEC extern const opal_paffinity_base_component_1_1_0_t
|
||||||
mca_paffinity_windows_component;
|
mca_paffinity_windows_component;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* paffinity query API function
|
* paffinity query API function
|
||||||
*/
|
*/
|
||||||
const opal_paffinity_base_module_1_0_0_t *
|
const opal_paffinity_base_module_1_1_0_t *
|
||||||
opal_paffinity_windows_component_query(int *query);
|
opal_paffinity_windows_component_query(int *query);
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
|
@ -44,7 +44,7 @@ static int windows_open(void);
|
|||||||
* and pointers to our public functions in it
|
* and pointers to our public functions in it
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const opal_paffinity_base_component_1_0_0_t mca_paffinity_windows_component = {
|
const opal_paffinity_base_component_1_1_0_t mca_paffinity_windows_component = {
|
||||||
|
|
||||||
/* First, the mca_component_t struct containing meta information
|
/* First, the mca_component_t struct containing meta information
|
||||||
about the component itself */
|
about the component itself */
|
||||||
@ -53,7 +53,7 @@ const opal_paffinity_base_component_1_0_0_t mca_paffinity_windows_component = {
|
|||||||
/* Indicate that we are a paffinity v1.0.0 component (which also
|
/* Indicate that we are a paffinity v1.0.0 component (which also
|
||||||
implies a specific MCA version) */
|
implies a specific MCA version) */
|
||||||
|
|
||||||
OPAL_PAFFINITY_BASE_VERSION_1_0_0,
|
OPAL_PAFFINITY_BASE_VERSION_1_1_0,
|
||||||
|
|
||||||
/* Component name and version */
|
/* Component name and version */
|
||||||
|
|
||||||
|
@ -28,30 +28,30 @@
|
|||||||
* Local functions
|
* Local functions
|
||||||
*/
|
*/
|
||||||
static int windows_module_init(void);
|
static int windows_module_init(void);
|
||||||
|
static int windows_module_finalize(void);
|
||||||
static int windows_module_get_num_procs(int *num_procs);
|
static int windows_module_get_num_procs(int *num_procs);
|
||||||
static int windows_module_set(int id);
|
static int windows_module_set(opal_paffinity_base_cpu_set_t cpumask);
|
||||||
static int windows_module_get(int *id);
|
static int windows_module_get(opal_paffinity_base_cpu_set_t *cpumask);
|
||||||
|
|
||||||
static SYSTEM_INFO sys_info;
|
static SYSTEM_INFO sys_info;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Linux paffinity module
|
* Linux paffinity module
|
||||||
*/
|
*/
|
||||||
static const opal_paffinity_base_module_1_0_0_t module = {
|
static const opal_paffinity_base_module_1_1_0_t module = {
|
||||||
|
|
||||||
/* Initialization function */
|
/* Initialization function */
|
||||||
|
|
||||||
windows_module_init,
|
windows_module_init,
|
||||||
|
|
||||||
/* Module function pointers */
|
/* Module function pointers */
|
||||||
|
|
||||||
windows_module_get_num_procs,
|
|
||||||
windows_module_set,
|
windows_module_set,
|
||||||
windows_module_get
|
windows_module_get,
|
||||||
|
windows_module_finalize
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const opal_paffinity_base_module_1_0_0_t *
|
const opal_paffinity_base_module_1_1_0_t *
|
||||||
opal_paffinity_windows_component_query(int *query)
|
opal_paffinity_windows_component_query(int *query)
|
||||||
{
|
{
|
||||||
int param;
|
int param;
|
||||||
@ -62,6 +62,10 @@ opal_paffinity_windows_component_query(int *query)
|
|||||||
return &module;
|
return &module;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int windows_module_finalize(void)
|
||||||
|
{
|
||||||
|
return OPAL_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static int windows_module_init(void)
|
static int windows_module_init(void)
|
||||||
{
|
{
|
||||||
@ -77,7 +81,7 @@ static int windows_module_get_num_procs(int *num_procs)
|
|||||||
return OPAL_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int windows_module_set(int id)
|
static int windows_module_set(opal_paffinity_base_cpu_set_t cpumask)
|
||||||
{
|
{
|
||||||
HANDLE threadid = GetCurrentThread();
|
HANDLE threadid = GetCurrentThread();
|
||||||
DWORD_PTR process_mask, system_mask;
|
DWORD_PTR process_mask, system_mask;
|
||||||
@ -86,8 +90,8 @@ static int windows_module_set(int id)
|
|||||||
return OPAL_ERR_NOT_FOUND;
|
return OPAL_ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (int)(1 << id) & (system_mask & 0xFFFFFFFF) ) {
|
if( (int)(1 << cpumask.bitmask[0]) & (system_mask & 0xFFFFFFFF) ) {
|
||||||
process_mask = (int)(1 << id);
|
process_mask = (int)(1 << cpumask.bitmask[0]);
|
||||||
if( SetThreadAffinityMask( threadid, process_mask ) )
|
if( SetThreadAffinityMask( threadid, process_mask ) )
|
||||||
return OPAL_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
/* otherwise something went wrong */
|
/* otherwise something went wrong */
|
||||||
@ -97,16 +101,16 @@ static int windows_module_set(int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int windows_module_get(int *id)
|
static int windows_module_get(opal_paffinity_base_cpu_set_t *cpumask)
|
||||||
{
|
{
|
||||||
HANDLE threadid = GetCurrentThread();
|
HANDLE threadid = GetCurrentThread();
|
||||||
DWORD_PTR process_mask, system_mask;
|
DWORD_PTR process_mask, system_mask;
|
||||||
|
|
||||||
if( GetProcessAffinityMask( threadid, &process_mask, &system_mask ) ) {
|
if( GetProcessAffinityMask( threadid, &process_mask, &system_mask ) ) {
|
||||||
*id = (int)process_mask;
|
cpumask->bitmask[0] = (opal_paffinity_base_bitmask_t)process_mask;
|
||||||
return OPAL_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
*id = 1;
|
cpumask->bitmask[0] = 1;
|
||||||
return OPAL_ERR_BAD_PARAM;
|
return OPAL_ERR_BAD_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user