Merge branch 'develop' of ssh://code.ascee.nl:12001/ASCEE/lasp into develop
This commit is contained in:
commit
1e3adf1835
18
lasp/c/lasp_nprocs.c
Normal file
18
lasp/c/lasp_nprocs.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifdef MS_WIN64
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
// Used for obtaining the number of processors
|
||||||
|
#include <sys/sysinfo.h>
|
||||||
|
#endif
|
||||||
|
#include "lasp_nprocs.h"
|
||||||
|
|
||||||
|
us getNumberOfProcs() {
|
||||||
|
#if MS_WIN64
|
||||||
|
// https://stackoverflow.com/questions/150355/programmatically-find-the-number-of-cores-on-a-machine
|
||||||
|
SYSTEM_INFO sysinfo;
|
||||||
|
GetSystemInfo(&sysinfo);
|
||||||
|
return sysinfo.dwNumberOfProcessors;
|
||||||
|
#else
|
||||||
|
return get_nprocs();
|
||||||
|
#endif
|
||||||
|
}
|
18
lasp/c/lasp_nprocs.h
Normal file
18
lasp/c/lasp_nprocs.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// lasp_nprocs.h
|
||||||
|
//
|
||||||
|
// Author: J.A. de Jong - ASCEE
|
||||||
|
//
|
||||||
|
// Description: Implemententation of a function to determine the number
|
||||||
|
// of processors.
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
#pragma once
|
||||||
|
#ifndef LASP_NPROCS_H
|
||||||
|
#define LASP_NPROCS_H
|
||||||
|
#include "lasp_types.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The number of SMP processors
|
||||||
|
*/
|
||||||
|
us getNumberOfProcs();
|
||||||
|
|
||||||
|
#endif // LASP_NPROCS_H
|
Loading…
Reference in New Issue
Block a user