Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alta
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alta
alta
Commits
1963695d
Commit
1963695d
authored
Mar 26, 2013
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changing the name of the function, it is only returning the total memory on the
system. Updated the computation of the memory cost.
parent
1ec36b2a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
sources/core/plugins_manager.cpp
sources/core/plugins_manager.cpp
+2
-2
sources/core/plugins_manager.h
sources/core/plugins_manager.h
+2
-2
sources/plugins/rational_fitter_parallel/rational_fitter.cpp
sources/plugins/rational_fitter_parallel/rational_fitter.cpp
+7
-7
No files found.
sources/core/plugins_manager.cpp
View file @
1963695d
...
@@ -162,7 +162,7 @@ fitter* plugins_manager::get_fitter(const std::string& n) const
...
@@ -162,7 +162,7 @@ fitter* plugins_manager::get_fitter(const std::string& n) const
// \todo implement the Darwin (MACOS) version.
// \todo implement the Darwin (MACOS) version.
#ifdef WIN32
#ifdef WIN32
#include <windows.h>
#include <windows.h>
size_t
plugins_manager
::
get_
available
_memory
()
size_t
plugins_manager
::
get_
system
_memory
()
{
{
MEMORYSTATUSEX
status
;
MEMORYSTATUSEX
status
;
status
.
dwLength
=
sizeof
(
status
);
status
.
dwLength
=
sizeof
(
status
);
...
@@ -171,7 +171,7 @@ size_t plugins_manager::get_available_memory()
...
@@ -171,7 +171,7 @@ size_t plugins_manager::get_available_memory()
}
}
#else
#else
#include <unistd.h>
#include <unistd.h>
size_t
plugins_manager
::
get_
available
_memory
()
size_t
plugins_manager
::
get_
system
_memory
()
{
{
long
pages
=
sysconf
(
_SC_PHYS_PAGES
);
long
pages
=
sysconf
(
_SC_PHYS_PAGES
);
long
page_size
=
sysconf
(
_SC_PAGE_SIZE
);
long
page_size
=
sysconf
(
_SC_PAGE_SIZE
);
...
...
sources/core/plugins_manager.h
View file @
1963695d
...
@@ -32,10 +32,10 @@ class plugins_manager
...
@@ -32,10 +32,10 @@ class plugins_manager
data
*
get_data
(
const
std
::
string
&
n
)
const
;
data
*
get_data
(
const
std
::
string
&
n
)
const
;
fitter
*
get_fitter
(
const
std
::
string
&
n
)
const
;
fitter
*
get_fitter
(
const
std
::
string
&
n
)
const
;
//! \brief Provide a measure of how much
free memory is left
on the system.
//! \brief Provide a measure of how much
memory there is
on the system.
//! \details It permits to know is one can allocate more memory for a fitting
//! \details It permits to know is one can allocate more memory for a fitting
//! procedure for example.
//! procedure for example.
static
size_t
get_
available
_memory
()
;
static
size_t
get_
system
_memory
()
;
private:
//data
private:
//data
...
...
sources/plugins/rational_fitter_parallel/rational_fitter.cpp
View file @
1963695d
...
@@ -61,21 +61,21 @@ bool rational_fitter_parallel::fit_data(const data* dat, function* fit)
...
@@ -61,21 +61,21 @@ bool rational_fitter_parallel::fit_data(const data* dat, function* fit)
// Allocate enough processor to run fully in parallel, but account for
// Allocate enough processor to run fully in parallel, but account for
// the fact that each thread will require its own memory.
// the fact that each thread will require its own memory.
size_t
need_memory
=
(
i
+
1
)
*
d
->
size
()
*
2
*
sizeof
(
double
);
size_t
need_memory
=
(
(
3
*
i
+
1
)
*
d
->
size
()
*
2
+
2
*
i
+
2
*
d
->
dimY
()
*
d
->
size
())
*
sizeof
(
double
);
size_t
avai_memory
=
plugins_manager
::
get_
available
_memory
();
size_t
avai_memory
=
plugins_manager
::
get_
system
_memory
();
int
nb_cores
=
avai_memory
/
need_memory
;
int
nb_cores
=
(
60
*
avai_memory
)
/
(
100
*
need_memory
)
;
nb_cores
=
std
::
min
<
int
>
(
nb_cores
,
omp_get_num_procs
());
nb_cores
=
std
::
min
<
int
>
(
nb_cores
,
omp_get_num_procs
());
if
(
nb_cores
==
0
)
if
(
nb_cores
==
0
)
{
{
std
::
cerr
<<
"<<ERROR>> not enough memory to perform the fit"
<<
std
::
endl
;
std
::
cerr
<<
"<<ERROR>> not enough memory to perform the fit"
<<
std
::
endl
;
#if
n
def DEBUG
#ifdef DEBUG
std
::
cout
<<
"<<DEBUG>> "
<<
need_memory
/
1024
<<
"MB required / "
std
::
cout
<<
"<<DEBUG>> "
<<
need_memory
/
(
1024
*
1024
)
<<
"MB required / "
<<
avai_memory
/
1024
<<
"MB available"
<<
std
::
endl
;
<<
avai_memory
/
(
1024
*
1024
)
<<
"MB available"
<<
std
::
endl
;
#endif
#endif
return
false
;
return
false
;
}
}
#if
n
def DEBUG
#ifdef DEBUG
std
::
cout
<<
"<<DEBUG>> will use "
<<
nb_cores
<<
" threads to compute the quadratic programs"
<<
std
::
endl
;
std
::
cout
<<
"<<DEBUG>> will use "
<<
nb_cores
<<
" threads to compute the quadratic programs"
<<
std
::
endl
;
#endif
#endif
omp_set_num_threads
(
nb_cores
)
;
omp_set_num_threads
(
nb_cores
)
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment