Merge branch 'develop' of ssh://code.ascee.nl:12001/ASCEE/lasp into develop

This commit is contained in:
Anne de Jong 2021-05-23 19:21:17 +02:00
commit 1e3adf1835
2 changed files with 36 additions and 0 deletions

18
lasp/c/lasp_nprocs.c Normal file
View 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
View 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