Skip to content
Snippets Groups Projects
Commit 89550f56 authored by Veronique Legrand's avatar Veronique Legrand
Browse files

fixed merge conflict

parents e728ffb4 446773f3
No related branches found
No related tags found
No related merge requests found
......@@ -18,25 +18,29 @@
using namespace std;
/*
* Use this function to get the amount of RAM on the machine (used or not).
* Use this function to get the amount of RAM in GB on the machine (used or not).
* Aim is to make sure that ROCK can run on the current machine with the requirements that the user gave.
*/
unsigned long getNodePhysMemory() {
#ifdef __linux__
return sysconf(_SC_PHYS_PAGES)*sysconf(_SC_PAGESIZE)/1024/1024/1024;
uint64_t mem = 0;
#if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
mem = sysconf(_SC_PHYS_PAGES);
mem *= sysconf(_SC_PAGESIZE);
mem /= 1 * 1024 * 1024 * 1024;
#elif __APPLE__
int64_t mem;
size_t len = sizeof(mem);
int ret=sysctlbyname("hw.memsize", (void*) &mem, &len, NULL,0); // total RAM is given in bytes; so convert it to MB.*/
int ret=sysctlbyname("hw.memsize", (void*) &mem, &len, NULL,0);
if (ret==-1) {
cout<<"Couldn't determine how much RAM is usable on your system."<<errno<<endl;
return errno;
mem=0;
}
return mem/1024/1024/1024;
mem /= 1 * 1024 * 1024 * 1024;
#else
cout<<"ROCK has not been tested on this operating system, please contact author."<<endl;
return unknown_os;
#endif
return (unsigned long)mem;
}
......
......@@ -29,7 +29,6 @@
#define unknown_os 1
#define defaultGRPMAXSize 1 //(in gigabytes) Default maximum size of srp structure but of course this size depends of the number of reads we are processing.
// 1 GB is enough to store approx 82 millions of reads (must take into account memory needed for stl containers).
// This constant is used only if you use rock's default behavior (use 90% of the machine's RAM).
......@@ -145,7 +144,7 @@ int main(int argc,char * argv[]) {
parms.lambda=0;
parms.filter_size=getNodePhysMemory()/100*90-defaultGRPMAXSize; // Prefer not to use all the machine's memory
if (parms.filter_size==unknown_os) return EXIT_FAILURE;
if (parms.filter_size==0) return EXIT_FAILURE;
while((i = getopt(argc, argv, "i:o:l:k:c:C:g:n:")) != -1) {
switch(i) {
case 'i':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment