{
  "id": 23162,
  "title": "nthread for xgb in r",
  "url": "/competitions/grupo-bimbo-inventory-demand/discussion/23162",
  "author_name": "",
  "post_date": "2016-08-29T14:57:15.340Z",
  "votes": null,
  "comment_count": 4,
  "views": 613,
  "content": "<p>Hi folks, I've hit a rock in my road....blue screen of death on my main desktop with &quot;pfn_list_corrupt&quot; as the error message prior to shutting itself down. I managed a single reboot, where it said that Win 10 hadnt loaded correctly and I now need to do a recovery installation. Oh dear, or stronger words to that effect.</p>\n\n<p>I was running xgb in a loop (I've broken my data into 256 chunks, so each chunk doesnt take up much ram). I was using 6 threads for xgboost, on a i7 870 (8 threads) clocked to 3.2ghz (mild overclock). I'm using 16gb of low latency cas 9 Crucial ram, so I dont think its the hardware.</p>\n\n<p>Reading on line, I found this:\n<a href=\"http://www.quintuitive.com/2016/05/08/much-parallelism-bad/\">http://www.quintuitive.com/2016/05/08/much-parallelism-bad/</a>\nWhich suggests to not run xgb in parallel....may explain the difference in run time between xgb and gbm. Trouble is that I really need to run it in parallel in order to finish on time, with a reasonable setting for nrounds.</p>\n\n<p>Does anyone have any recommendations for nthreads from a laptop...I've got an i5 4300m on my laptop, which is a duo core with 4 threads. I am a bit concerned that I do the same to my latop.</p>\n\n<p>Incidentally, I can highly recommend using a NAS drive....everything on my desktop has fortunately synced to the laptop, so I have the original script running on this on a single nthread=1, just to be safe.</p>",
  "messages": [
    {
      "id": "132817",
      "postDate": "08/29/2016 14:57:15",
      "content": "<p>Hi folks, I've hit a rock in my road....blue screen of death on my main desktop with &quot;pfn_list_corrupt&quot; as the error message prior to shutting itself down. I managed a single reboot, where it said that Win 10 hadnt loaded correctly and I now need to do a recovery installation. Oh dear, or stronger words to that effect.</p>\n\n<p>I was running xgb in a loop (I've broken my data into 256 chunks, so each chunk doesnt take up much ram). I was using 6 threads for xgboost, on a i7 870 (8 threads) clocked to 3.2ghz (mild overclock). I'm using 16gb of low latency cas 9 Crucial ram, so I dont think its the hardware.</p>\n\n<p>Reading on line, I found this:\n<a href=\"http://www.quintuitive.com/2016/05/08/much-parallelism-bad/\">http://www.quintuitive.com/2016/05/08/much-parallelism-bad/</a>\nWhich suggests to not run xgb in parallel....may explain the difference in run time between xgb and gbm. Trouble is that I really need to run it in parallel in order to finish on time, with a reasonable setting for nrounds.</p>\n\n<p>Does anyone have any recommendations for nthreads from a laptop...I've got an i5 4300m on my laptop, which is a duo core with 4 threads. I am a bit concerned that I do the same to my latop.</p>\n\n<p>Incidentally, I can highly recommend using a NAS drive....everything on my desktop has fortunately synced to the laptop, so I have the original script running on this on a single nthread=1, just to be safe.</p>",
      "rawMarkdown": "Hi folks, I've hit a rock in my road....blue screen of death on my main desktop with \"pfn_list_corrupt\" as the error message prior to shutting itself down. I managed a single reboot, where it said that Win 10 hadnt loaded correctly and I now need to do a recovery installation. Oh dear, or stronger words to that effect.\r\n\r\nI was running xgb in a loop (I've broken my data into 256 chunks, so each chunk doesnt take up much ram). I was using 6 threads for xgboost, on a i7 870 (8 threads) clocked to 3.2ghz (mild overclock). I'm using 16gb of low latency cas 9 Crucial ram, so I dont think its the hardware.\r\n\r\nReading on line, I found this:\r\nhttp://www.quintuitive.com/2016/05/08/much-parallelism-bad/\r\nWhich suggests to not run xgb in parallel....may explain the difference in run time between xgb and gbm. Trouble is that I really need to run it in parallel in order to finish on time, with a reasonable setting for nrounds.\r\n\r\nDoes anyone have any recommendations for nthreads from a laptop...I've got an i5 4300m on my laptop, which is a duo core with 4 threads. I am a bit concerned that I do the same to my latop.\r\n\r\nIncidentally, I can highly recommend using a NAS drive....everything on my desktop has fortunately synced to the laptop, so I have the original script running on this on a single nthread=1, just to be safe.",
      "votes": null
    },
    {
      "id": "132821",
      "postDate": "08/29/2016 15:07:52",
      "content": "<p>I think that given the time constraints your best chance is aws (and it shouldn't cost you much considering the time left...)</p>",
      "rawMarkdown": "I think that given the time constraints your best chance is aws (and it shouldn't cost you much considering the time left...)",
      "votes": null
    },
    {
      "id": "132823",
      "postDate": "08/29/2016 15:23:56",
      "content": "<p>Yeah, this is distinctly suboptimal presently, but I have a cup of tea, music on, and my laptop is presently taking 5 minutes per chunk with nrounds = 750. I've not used AWS yet, but was investigating with it using a Louis Aslett AMI, and Dropbox.</p>\n\n<p>I am just experimenting with nthread = 1 on the laptop and I have also put gc() and sys.sleep(10) statements in at the bottom of the loops through the chunks, to let it gather its thoughts on each loop. This may or may not just be supersticion, but I am giving it some opportunity to sort whatever processes out which it has running in the background. </p>\n\n<p>To add insult to injury, I had upgraded the desktop from Win 7 to Win 10, and have a feeling I now dont have the necessary Win 10 licence key...so that will be something like 70 quid to get the machine runing again. Thanks MSFT. Makes me think I should just try a Ubuntu installation.</p>\n\n<p>I spent a couple of days mucking about with Azure and EC2, and in the end thought the EC2 solution looks best for my needs. I picked up the recent Packt book on EC2 and Azure and Hadoop and can recommend it. </p>\n\n<p>However, I was transfering the train file across to an S3 bucket using the command terminal, but it failed, for no good reason, halfway through, so I started using Cloud Berry....looked like it was going to take several hours to get the data across. Reading Louis Aslett's excellent website about using his AMI's, it sounds like Dropbox can sync with AWS, but I didnt get the train file to go across to the t2 micro instance. So I started mucking about on the desktop instead....</p>",
      "rawMarkdown": "Yeah, this is distinctly suboptimal presently, but I have a cup of tea, music on, and my laptop is presently taking 5 minutes per chunk with nrounds = 750. I've not used AWS yet, but was investigating with it using a Louis Aslett AMI, and Dropbox.\r\n\r\nI am just experimenting with nthread = 1 on the laptop and I have also put gc() and sys.sleep(10) statements in at the bottom of the loops through the chunks, to let it gather its thoughts on each loop. This may or may not just be supersticion, but I am giving it some opportunity to sort whatever processes out which it has running in the background. \r\n\r\nTo add insult to injury, I had upgraded the desktop from Win 7 to Win 10, and have a feeling I now dont have the necessary Win 10 licence key...so that will be something like 70 quid to get the machine runing again. Thanks MSFT. Makes me think I should just try a Ubuntu installation.\r\n\r\nI spent a couple of days mucking about with Azure and EC2, and in the end thought the EC2 solution looks best for my needs. I picked up the recent Packt book on EC2 and Azure and Hadoop and can recommend it. \r\n\r\nHowever, I was transfering the train file across to an S3 bucket using the command terminal, but it failed, for no good reason, halfway through, so I started using Cloud Berry....looked like it was going to take several hours to get the data across. Reading Louis Aslett's excellent website about using his AMI's, it sounds like Dropbox can sync with AWS, but I didnt get the train file to go across to the t2 micro instance. So I started mucking about on the desktop instead....",
      "votes": null
    },
    {
      "id": "132847",
      "postDate": "08/29/2016 18:19:17",
      "content": "<p>[quote=anonemaus;132817]</p>\n\n<p>Reading on line, I found this:\n<a href=\"http://www.quintuitive.com/2016/05/08/much-parallelism-bad/\">http://www.quintuitive.com/2016/05/08/much-parallelism-bad/</a>\nWhich suggests to not run xgb in parallel....may explain the difference in run time between xgb and gbm. Trouble is that I really need to run it in parallel in order to finish on time, with a reasonable setting for nrounds.</p>\n\n<p>[/quote]</p>\n\n<p>xgboost in parallel should do nothing wrong unless you are using:</p>\n\n<ul>\n<li>Something that tries to multithread tasks before xgboost (like doParallel + caret =&gt; multithreading a multithread... if something sees 8 threads from 4 cores, it can make up to 64 threads!)</li>\n<li>Specific multi-CPU setups</li>\n<li>A massive amount of swap and end up with random memory corruption</li>\n</ul>\n\n<p>If you have multithreading and you are using xgboost, under Windows 8 included: Task Manager cannot report hyperthreading properly, and will report you 50% if all cores are used when you run xgboost with an optimal amount of threads, and more than 50% if you use more running threads physical cores. In the latter case, it becomes (slightly) slower and you use 2x more RAM than you should. Hence, if you see your R session taking 50% of CPU when running xgboost, you are effectively running with all cores pegged to maximum.</p>\n\n<p>For Windows 10 I do not know if it does apply. But you can always check by running some benchmarks on xgboost and compare the total running time depending on the amount of threads you use.</p>\n\n<p>[quote=anonemaus;132823]</p>\n\n<p>I am just experimenting with nthread = 1 on the laptop and I have also put <strong>gc()</strong> and sys.sleep(10) statements in at the bottom of the loops through the chunks, to let it gather its thoughts on each loop. This may or may not just be supersticion, but I am giving it some opportunity to sort whatever processes out which it has running in the background. </p>\n\n<p>[/quote]</p>\n\n<p>I suspect if you were using xgboost 256 times and not garbage collect everytime, you end up with a massive R session in RAM/swap. R does not gc() automatically in 99% of the times and xgboost leaks memory everytime you run xgb.train/xgb.cv/xgb.DMatrix/etc... (R can't get forced to use gc() due to xgboost anyway, as it cannot see the memory mapped by xgboost).</p>\n\n<p>Typically, Windows machines like crashing when overdriving the swap (unresponsiveness until a bad thread collision happens randomly =&gt; Windows error, typically a kernel error induced by a hardware error). The hardware error (induced by a software error) is also, typically:</p>\n\n<ul>\n<li>A read error</li>\n<li>A write error</li>\n<li>A page error</li>\n<li>A flipped bit somewhere</li>\n<li>2 threads are fighting over to reclaim an identical page</li>\n<li>...</li>\n</ul>\n\n<p>And from there, it becomes obvious a &quot;hardware&quot; error pops up out of nowhere. If it happens at a very bad place, recovery is less than possible.</p>\n\n<p>I had an identical crash the last day of Home Depot by testing a new model &quot;for fun&quot; that ate 60+ GB memory when I had only 16GB. It took less than 10 minutes to crash Windows automatically, but I had an image I could restore immediately in less 5 minutes only (+ Linux on another internal drive). I also saw similar cases the last 3 years when running AI courses on desktops which have less than 4GB RAM and needed to train a large RAM eater (30GB+) model.</p>",
      "rawMarkdown": "[quote=anonemaus;132817]\r\n\r\nReading on line, I found this:\r\nhttp://www.quintuitive.com/2016/05/08/much-parallelism-bad/\r\nWhich suggests to not run xgb in parallel....may explain the difference in run time between xgb and gbm. Trouble is that I really need to run it in parallel in order to finish on time, with a reasonable setting for nrounds.\r\n\r\n[/quote]\r\n\r\nxgboost in parallel should do nothing wrong unless you are using:\r\n\r\n* Something that tries to multithread tasks before xgboost (like doParallel + caret => multithreading a multithread... if something sees 8 threads from 4 cores, it can make up to 64 threads!)\r\n* Specific multi-CPU setups\r\n* A massive amount of swap and end up with random memory corruption\r\n\r\nIf you have multithreading and you are using xgboost, under Windows 8 included: Task Manager cannot report hyperthreading properly, and will report you 50% if all cores are used when you run xgboost with an optimal amount of threads, and more than 50% if you use more running threads physical cores. In the latter case, it becomes (slightly) slower and you use 2x more RAM than you should. Hence, if you see your R session taking 50% of CPU when running xgboost, you are effectively running with all cores pegged to maximum.\r\n\r\nFor Windows 10 I do not know if it does apply. But you can always check by running some benchmarks on xgboost and compare the total running time depending on the amount of threads you use.\r\n\r\n[quote=anonemaus;132823]\r\n\r\nI am just experimenting with nthread = 1 on the laptop and I have also put **gc()** and sys.sleep(10) statements in at the bottom of the loops through the chunks, to let it gather its thoughts on each loop. This may or may not just be supersticion, but I am giving it some opportunity to sort whatever processes out which it has running in the background. \r\n\r\n[/quote]\r\n\r\nI suspect if you were using xgboost 256 times and not garbage collect everytime, you end up with a massive R session in RAM/swap. R does not gc() automatically in 99% of the times and xgboost leaks memory everytime you run xgb.train/xgb.cv/xgb.DMatrix/etc... (R can't get forced to use gc() due to xgboost anyway, as it cannot see the memory mapped by xgboost).\r\n\r\nTypically, Windows machines like crashing when overdriving the swap (unresponsiveness until a bad thread collision happens randomly => Windows error, typically a kernel error induced by a hardware error). The hardware error (induced by a software error) is also, typically:\r\n\r\n* A read error\r\n* A write error\r\n* A page error\r\n* A flipped bit somewhere\r\n* 2 threads are fighting over to reclaim an identical page\r\n* ...\r\n\r\nAnd from there, it becomes obvious a \"hardware\" error pops up out of nowhere. If it happens at a very bad place, recovery is less than possible.\r\n\r\nI had an identical crash the last day of Home Depot by testing a new model \"for fun\" that ate 60+ GB memory when I had only 16GB. It took less than 10 minutes to crash Windows automatically, but I had an image I could restore immediately in less 5 minutes only (+ Linux on another internal drive). I also saw similar cases the last 3 years when running AI courses on desktops which have less than 4GB RAM and needed to train a large RAM eater (30GB+) model.",
      "votes": null
    },
    {
      "id": "132850",
      "postDate": "08/29/2016 19:23:31",
      "content": "<p>thanks for this, I had an errant library(doParallel) at the top of my script, so I will try commenting it out and see what happens, I have a gc() at the end of each chunk I am processing</p>\n\n<p>at the moment I am just running with 1 thread....its substantially slower but the CPU usage doesnt climb</p>\n\n<p>regarding backing up computers, I had done this Win 10 upgrade and not created an image, I am just syncing files to a NAS drive...I am presently rebooting the desktop with Win 7 installation discs and will start that running in tandem....I have a manual version of map reduce going on... the trick is going to be working out how to sew all the data back together in time for submission tomorrow</p>",
      "rawMarkdown": "thanks for this, I had an errant library(doParallel) at the top of my script, so I will try commenting it out and see what happens, I have a gc() at the end of each chunk I am processing\r\n\r\nat the moment I am just running with 1 thread....its substantially slower but the CPU usage doesnt climb\r\n\r\nregarding backing up computers, I had done this Win 10 upgrade and not created an image, I am just syncing files to a NAS drive...I am presently rebooting the desktop with Win 7 installation discs and will start that running in tandem....I have a manual version of map reduce going on... the trick is going to be working out how to sew all the data back together in time for submission tomorrow",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 132821,
      "author_name": "interesting",
      "author_url": "",
      "post_date": "08/29/2016 15:07:52",
      "content": "<p>I think that given the time constraints your best chance is aws (and it shouldn't cost you much considering the time left...)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 132823,
      "author_name": "anonemaus",
      "author_url": "",
      "post_date": "08/29/2016 15:23:56",
      "content": "<p>Yeah, this is distinctly suboptimal presently, but I have a cup of tea, music on, and my laptop is presently taking 5 minutes per chunk with nrounds = 750. I've not used AWS yet, but was investigating with it using a Louis Aslett AMI, and Dropbox.</p>\n\n<p>I am just experimenting with nthread = 1 on the laptop and I have also put gc() and sys.sleep(10) statements in at the bottom of the loops through the chunks, to let it gather its thoughts on each loop. This may or may not just be supersticion, but I am giving it some opportunity to sort whatever processes out which it has running in the background. </p>\n\n<p>To add insult to injury, I had upgraded the desktop from Win 7 to Win 10, and have a feeling I now dont have the necessary Win 10 licence key...so that will be something like 70 quid to get the machine runing again. Thanks MSFT. Makes me think I should just try a Ubuntu installation.</p>\n\n<p>I spent a couple of days mucking about with Azure and EC2, and in the end thought the EC2 solution looks best for my needs. I picked up the recent Packt book on EC2 and Azure and Hadoop and can recommend it. </p>\n\n<p>However, I was transfering the train file across to an S3 bucket using the command terminal, but it failed, for no good reason, halfway through, so I started using Cloud Berry....looked like it was going to take several hours to get the data across. Reading Louis Aslett's excellent website about using his AMI's, it sounds like Dropbox can sync with AWS, but I didnt get the train file to go across to the t2 micro instance. So I started mucking about on the desktop instead....</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 132847,
      "author_name": "laurae2",
      "author_url": "",
      "post_date": "08/29/2016 18:19:17",
      "content": "<p>[quote=anonemaus;132817]</p>\n\n<p>Reading on line, I found this:\n<a href=\"http://www.quintuitive.com/2016/05/08/much-parallelism-bad/\">http://www.quintuitive.com/2016/05/08/much-parallelism-bad/</a>\nWhich suggests to not run xgb in parallel....may explain the difference in run time between xgb and gbm. Trouble is that I really need to run it in parallel in order to finish on time, with a reasonable setting for nrounds.</p>\n\n<p>[/quote]</p>\n\n<p>xgboost in parallel should do nothing wrong unless you are using:</p>\n\n<ul>\n<li>Something that tries to multithread tasks before xgboost (like doParallel + caret =&gt; multithreading a multithread... if something sees 8 threads from 4 cores, it can make up to 64 threads!)</li>\n<li>Specific multi-CPU setups</li>\n<li>A massive amount of swap and end up with random memory corruption</li>\n</ul>\n\n<p>If you have multithreading and you are using xgboost, under Windows 8 included: Task Manager cannot report hyperthreading properly, and will report you 50% if all cores are used when you run xgboost with an optimal amount of threads, and more than 50% if you use more running threads physical cores. In the latter case, it becomes (slightly) slower and you use 2x more RAM than you should. Hence, if you see your R session taking 50% of CPU when running xgboost, you are effectively running with all cores pegged to maximum.</p>\n\n<p>For Windows 10 I do not know if it does apply. But you can always check by running some benchmarks on xgboost and compare the total running time depending on the amount of threads you use.</p>\n\n<p>[quote=anonemaus;132823]</p>\n\n<p>I am just experimenting with nthread = 1 on the laptop and I have also put <strong>gc()</strong> and sys.sleep(10) statements in at the bottom of the loops through the chunks, to let it gather its thoughts on each loop. This may or may not just be supersticion, but I am giving it some opportunity to sort whatever processes out which it has running in the background. </p>\n\n<p>[/quote]</p>\n\n<p>I suspect if you were using xgboost 256 times and not garbage collect everytime, you end up with a massive R session in RAM/swap. R does not gc() automatically in 99% of the times and xgboost leaks memory everytime you run xgb.train/xgb.cv/xgb.DMatrix/etc... (R can't get forced to use gc() due to xgboost anyway, as it cannot see the memory mapped by xgboost).</p>\n\n<p>Typically, Windows machines like crashing when overdriving the swap (unresponsiveness until a bad thread collision happens randomly =&gt; Windows error, typically a kernel error induced by a hardware error). The hardware error (induced by a software error) is also, typically:</p>\n\n<ul>\n<li>A read error</li>\n<li>A write error</li>\n<li>A page error</li>\n<li>A flipped bit somewhere</li>\n<li>2 threads are fighting over to reclaim an identical page</li>\n<li>...</li>\n</ul>\n\n<p>And from there, it becomes obvious a &quot;hardware&quot; error pops up out of nowhere. If it happens at a very bad place, recovery is less than possible.</p>\n\n<p>I had an identical crash the last day of Home Depot by testing a new model &quot;for fun&quot; that ate 60+ GB memory when I had only 16GB. It took less than 10 minutes to crash Windows automatically, but I had an image I could restore immediately in less 5 minutes only (+ Linux on another internal drive). I also saw similar cases the last 3 years when running AI courses on desktops which have less than 4GB RAM and needed to train a large RAM eater (30GB+) model.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 132850,
      "author_name": "anonemaus",
      "author_url": "",
      "post_date": "08/29/2016 19:23:31",
      "content": "<p>thanks for this, I had an errant library(doParallel) at the top of my script, so I will try commenting it out and see what happens, I have a gc() at the end of each chunk I am processing</p>\n\n<p>at the moment I am just running with 1 thread....its substantially slower but the CPU usage doesnt climb</p>\n\n<p>regarding backing up computers, I had done this Win 10 upgrade and not created an image, I am just syncing files to a NAS drive...I am presently rebooting the desktop with Win 7 installation discs and will start that running in tandem....I have a manual version of map reduce going on... the trick is going to be working out how to sew all the data back together in time for submission tomorrow</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "132817": "Hi folks, I've hit a rock in my road....blue screen of death on my main desktop with \"pfn_list_corrupt\" as the error message prior to shutting itself down. I managed a single reboot, where it said that Win 10 hadnt loaded correctly and I now need to do a recovery installation. Oh dear, or stronger words to that effect.\r\n\r\nI was running xgb in a loop (I've broken my data into 256 chunks, so each chunk doesnt take up much ram). I was using 6 threads for xgboost, on a i7 870 (8 threads) clocked to 3.2ghz (mild overclock). I'm using 16gb of low latency cas 9 Crucial ram, so I dont think its the hardware.\r\n\r\nReading on line, I found this:\r\nhttp://www.quintuitive.com/2016/05/08/much-parallelism-bad/\r\nWhich suggests to not run xgb in parallel....may explain the difference in run time between xgb and gbm. Trouble is that I really need to run it in parallel in order to finish on time, with a reasonable setting for nrounds.\r\n\r\nDoes anyone have any recommendations for nthreads from a laptop...I've got an i5 4300m on my laptop, which is a duo core with 4 threads. I am a bit concerned that I do the same to my latop.\r\n\r\nIncidentally, I can highly recommend using a NAS drive....everything on my desktop has fortunately synced to the laptop, so I have the original script running on this on a single nthread=1, just to be safe.",
    "132821": "I think that given the time constraints your best chance is aws (and it shouldn't cost you much considering the time left...)",
    "132823": "Yeah, this is distinctly suboptimal presently, but I have a cup of tea, music on, and my laptop is presently taking 5 minutes per chunk with nrounds = 750. I've not used AWS yet, but was investigating with it using a Louis Aslett AMI, and Dropbox.\r\n\r\nI am just experimenting with nthread = 1 on the laptop and I have also put gc() and sys.sleep(10) statements in at the bottom of the loops through the chunks, to let it gather its thoughts on each loop. This may or may not just be supersticion, but I am giving it some opportunity to sort whatever processes out which it has running in the background. \r\n\r\nTo add insult to injury, I had upgraded the desktop from Win 7 to Win 10, and have a feeling I now dont have the necessary Win 10 licence key...so that will be something like 70 quid to get the machine runing again. Thanks MSFT. Makes me think I should just try a Ubuntu installation.\r\n\r\nI spent a couple of days mucking about with Azure and EC2, and in the end thought the EC2 solution looks best for my needs. I picked up the recent Packt book on EC2 and Azure and Hadoop and can recommend it. \r\n\r\nHowever, I was transfering the train file across to an S3 bucket using the command terminal, but it failed, for no good reason, halfway through, so I started using Cloud Berry....looked like it was going to take several hours to get the data across. Reading Louis Aslett's excellent website about using his AMI's, it sounds like Dropbox can sync with AWS, but I didnt get the train file to go across to the t2 micro instance. So I started mucking about on the desktop instead....",
    "132847": "[quote=anonemaus;132817]\r\n\r\nReading on line, I found this:\r\nhttp://www.quintuitive.com/2016/05/08/much-parallelism-bad/\r\nWhich suggests to not run xgb in parallel....may explain the difference in run time between xgb and gbm. Trouble is that I really need to run it in parallel in order to finish on time, with a reasonable setting for nrounds.\r\n\r\n[/quote]\r\n\r\nxgboost in parallel should do nothing wrong unless you are using:\r\n\r\n* Something that tries to multithread tasks before xgboost (like doParallel + caret => multithreading a multithread... if something sees 8 threads from 4 cores, it can make up to 64 threads!)\r\n* Specific multi-CPU setups\r\n* A massive amount of swap and end up with random memory corruption\r\n\r\nIf you have multithreading and you are using xgboost, under Windows 8 included: Task Manager cannot report hyperthreading properly, and will report you 50% if all cores are used when you run xgboost with an optimal amount of threads, and more than 50% if you use more running threads physical cores. In the latter case, it becomes (slightly) slower and you use 2x more RAM than you should. Hence, if you see your R session taking 50% of CPU when running xgboost, you are effectively running with all cores pegged to maximum.\r\n\r\nFor Windows 10 I do not know if it does apply. But you can always check by running some benchmarks on xgboost and compare the total running time depending on the amount of threads you use.\r\n\r\n[quote=anonemaus;132823]\r\n\r\nI am just experimenting with nthread = 1 on the laptop and I have also put **gc()** and sys.sleep(10) statements in at the bottom of the loops through the chunks, to let it gather its thoughts on each loop. This may or may not just be supersticion, but I am giving it some opportunity to sort whatever processes out which it has running in the background. \r\n\r\n[/quote]\r\n\r\nI suspect if you were using xgboost 256 times and not garbage collect everytime, you end up with a massive R session in RAM/swap. R does not gc() automatically in 99% of the times and xgboost leaks memory everytime you run xgb.train/xgb.cv/xgb.DMatrix/etc... (R can't get forced to use gc() due to xgboost anyway, as it cannot see the memory mapped by xgboost).\r\n\r\nTypically, Windows machines like crashing when overdriving the swap (unresponsiveness until a bad thread collision happens randomly => Windows error, typically a kernel error induced by a hardware error). The hardware error (induced by a software error) is also, typically:\r\n\r\n* A read error\r\n* A write error\r\n* A page error\r\n* A flipped bit somewhere\r\n* 2 threads are fighting over to reclaim an identical page\r\n* ...\r\n\r\nAnd from there, it becomes obvious a \"hardware\" error pops up out of nowhere. If it happens at a very bad place, recovery is less than possible.\r\n\r\nI had an identical crash the last day of Home Depot by testing a new model \"for fun\" that ate 60+ GB memory when I had only 16GB. It took less than 10 minutes to crash Windows automatically, but I had an image I could restore immediately in less 5 minutes only (+ Linux on another internal drive). I also saw similar cases the last 3 years when running AI courses on desktops which have less than 4GB RAM and needed to train a large RAM eater (30GB+) model.",
    "132850": "thanks for this, I had an errant library(doParallel) at the top of my script, so I will try commenting it out and see what happens, I have a gc() at the end of each chunk I am processing\r\n\r\nat the moment I am just running with 1 thread....its substantially slower but the CPU usage doesnt climb\r\n\r\nregarding backing up computers, I had done this Win 10 upgrade and not created an image, I am just syncing files to a NAS drive...I am presently rebooting the desktop with Win 7 installation discs and will start that running in tandem....I have a manual version of map reduce going on... the trick is going to be working out how to sew all the data back together in time for submission tomorrow"
  },
  "source": "meta"
}