SynapseML icon indicating copy to clipboard operation
SynapseML copied to clipboard

Improve lightGBM performance on clusters with multiple cores per executor

Open imatiach-msft opened this issue 8 years ago • 36 comments

Currently lightGBM classifier and regressor underutilizes clusters that are configured with multiple cores per exector - I've created this issue to track this

imatiach-msft avatar Apr 20 '18 15:04 imatiach-msft

@imatiach-msft I also have this problem - do you need some more information? Or you reproduced the problem already in your environment?

troszok avatar Apr 25 '18 07:04 troszok

@troszok I have a repro in an Azure Databricks cluster I created, I'm still investigating, I just need to figure out how to retrieve the number of cores per executor in an efficient way prior to the NetworkInit of lightGBM (which requires a list of host:port values, so all of the workers need to be known ahead of time - note for multiple threads you can have duplicate host addresses with different ports) in the mapPartitions call

imatiach-msft avatar Apr 25 '18 13:04 imatiach-msft

@imatiach-msft great - let me know how can I help here I can do some testing with our data

troszok avatar Apr 30 '18 08:04 troszok

@troszok I've created a PR here: https://github.com/Azure/mmlspark/pull/296 I'm still testing the fix, but the results so far look promising - it looks like it is using all cores now. Also, with this fix hopefully initializing LightGBM's network will be more robust, as we will now ignore ports that are taken and 'auto-detect' open ports (whereas previously the user was supposed to select a range of ports that are open)

imatiach-msft avatar Apr 30 '18 14:04 imatiach-msft

@troszok @katerinagl @peay @ezerhoun I was able to benchmark the new classifier on the Higgs dataset in an Azure Databricks cluster with 3 executors, 8 cores per executor and LightGBM now took 1.36 minutes while GBTClassifier took 2.67 minutes, although LightGBM still had a better AUC (whereas previously, LightGBM took more than 5 minutes prior to the optimization). If you are interested, you can try out the new maven package using: --packages com.microsoft.ml.spark:mmlspark_2.11:0.12.dev4+4.g5155f289d --repositories https://mmlspark.azureedge.net/maven

imatiach-msft avatar May 01 '18 04:05 imatiach-msft

@imatiach-msft awesome, thanks! We will give it a try this week.

troszok avatar May 01 '18 06:05 troszok

It took longer than expected @imatiach-msft @elibarzilay where can i find the builds? It looks outdated and in the maven repo you have only the official 0.12 version

troszok avatar May 11 '18 14:05 troszok

@troszok you can try: --packages com.microsoft.ml.spark:mmlspark_2.11:0.12.dev6+1.gb8de8c3 --repositories https://mmlspark.azureedge.net/maven But if the previous build was still slower than expected then I'm not sure what is wrong. Can you post your example spark code? Did you try to use both the GBTClassifier and LightGBMClassifier as a comparison, and what were your approximate times? Did you use iterations=100 for LightGBM? I would recommend reducing it to a smaller value, eg 2, and compare across accuracy/AUC and execution time between GBTClassifier and LightGBMClassifier across different parameters.

imatiach-msft avatar May 11 '18 14:05 imatiach-msft

@imatiach-msft thanks but it doesnt exist - I tried:

spark-shell --packages com.microsoft.ml.spark:mmlspark_2.11:0.12.dev6+1.gb8de8c3 --repositories https://mmlspark.azureedge.net/maven
[cut]
	==== repo-1: tried

	  https://mmlspark.azureedge.net/maven/com/microsoft/ml/spark/mmlspark_2.11/0.12.dev6+1.gb8de8c3/mmlspark_2.11-0.12.dev6+1.gb8de8c3.pom

	  -- artifact com.microsoft.ml.spark#mmlspark_2.11;0.12.dev6+1.gb8de8c3!mmlspark_2.11.jar:

	  https://mmlspark.azureedge.net/maven/com/microsoft/ml/spark/mmlspark_2.11/0.12.dev6+1.gb8de8c3/mmlspark_2.11-0.12.dev6+1.gb8de8c3.jar

		::::::::::::::::::::::::::::::::::::::::::::::

		::          UNRESOLVED DEPENDENCIES         ::

		::::::::::::::::::::::::::::::::::::::::::::::

		:: com.microsoft.ml.spark#mmlspark_2.11;0.12.dev6+1.gb8de8c3: not found

		::::::::::::::::::::::::::::::::::::::::::::::



:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
Exception in thread "main" java.lang.RuntimeException: [unresolved dependency: com.microsoft.ml.spark#mmlspark_2.11;0.12.dev6+1.gb8de8c3: not found]
	at org.apache.spark.deploy.SparkSubmitUtils$.resolveMavenCoordinates(SparkSubmit.scala:1270)
	at org.apache.spark.deploy.DependencyUtils$.resolveMavenDependencies(DependencyUtils.scala:49)
	at org.apache.spark.deploy.SparkSubmit$.prepareSubmitEnvironment(SparkSubmit.scala:350)
	at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:170)
	at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:136)
	at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

We are interested in regressor not classifier - i will give it a ride when I have the artifacts.

troszok avatar May 11 '18 15:05 troszok

@troszok strange! I just tried it and it worked for me, and it seems like it is a public container, @mhamilton723 @elibarzilay any ideas what might be going on here - and could we possibly release another version with the performance fix soon (?):

ilya@ilya-Virtual-Machine:~/mmlspark$ spark-shell --packages com.microsoft.ml.spark:mmlspark_2.11:0.12.dev6+1.gb8de8c3 --repositories https://mmlspark.azureedge.net/maven https://mmlspark.azureedge.net/maven added as a remote repository with the name: repo-1 Ivy Default Cache set to: /home/ilya/.ivy2/cache The jars for the packages stored in: /home/ilya/.ivy2/jars :: loading settings :: url = jar:file:/home/ilya/lib/spark/jars/ivy-2.4.0.jar!/org/apache/ivy/core/settings/ivysettings.xml com.microsoft.ml.spark#mmlspark_2.11 added as a dependency :: resolving dependencies :: org.apache.spark#spark-submit-parent;1.0 confs: [default] found com.microsoft.ml.spark#mmlspark_2.11;0.12.dev6+1.gb8de8c3 in repo-1 found io.spray#spray-json_2.11;1.3.2 in user-list found com.microsoft.cntk#cntk;2.4 in user-list found org.openpnp#opencv;3.2.0-1 in user-list found com.microsoft.ml.lightgbm#lightgbmlib;2.0.120 in user-list downloading https://mmlspark.azureedge.net/maven/com/microsoft/ml/spark/mmlspark_2.11/0.12.dev6+1.gb8de8c3/mmlspark_2.11-0.12.dev6+1.gb8de8c3.jar ... [SUCCESSFUL ] com.microsoft.ml.spark#mmlspark_2.11;0.12.dev6+1.gb8de8c3!mmlspark_2.11.jar (141ms) :: resolution report :: resolve 2239ms :: artifacts dl 148ms :: modules in use: com.microsoft.cntk#cntk;2.4 from user-list in [default] com.microsoft.ml.lightgbm#lightgbmlib;2.0.120 from user-list in [default] com.microsoft.ml.spark#mmlspark_2.11;0.12.dev6+1.gb8de8c3 from repo-1 in [default] io.spray#spray-json_2.11;1.3.2 from user-list in [default] org.openpnp#opencv;3.2.0-1 from user-list in [default] --------------------------------------------------------------------- | | modules || artifacts | | conf | number| search|dwnlded|evicted|| number|dwnlded| --------------------------------------------------------------------- | default | 5 | 1 | 1 | 0 || 5 | 1 | ---------------------------------------------------------------------

imatiach-msft avatar May 11 '18 15:05 imatiach-msft

@imatiach-msft is it possible that when the PR was merge the artifact was removed and you are just using the file cached on the CDN?

troszok avatar May 11 '18 15:05 troszok

@imatiach-msft yes! when i run it on the server in us-east-1 the package can be fetched just fine (I am based in Europe). Thank you very much!

troszok avatar May 11 '18 15:05 troszok

@troszok I queued another build from latest master and will post it here once it finishes, hopefully in the next 2-3 hours (as long as the build doesn't fail, we have some random test failures that need to be fixed still)

imatiach-msft avatar May 11 '18 15:05 imatiach-msft

@troszok it looks like this build has finished: --packages com.microsoft.ml.spark:mmlspark_2.11:0.12.dev7 --repositories https://mmlspark.azureedge.net/maven Were you able to see a performance improvement or was it still slow? Please let me know, and thanks for using our package!

imatiach-msft avatar May 11 '18 21:05 imatiach-msft

@imatiach-msft it looks like that when it starts it is using all the CPUs but sometimes we are having a problem that our job fails with following stack trace:

18/05/16 08:46:17 INFO DAGScheduler: ResultStage 12 (reduce at LightGBMRegressor.scala:79) failed in 4626.704 s due to Job aborted due to stage failure: Task 0 in stage 12.0 failed 4 times, most recent failure: Lost task 0.3 in stage 12.0 (TID 1490, 172.33.8.149, executor 0): java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at java.net.Socket.connect(Socket.java:538)
	at java.net.Socket.<init>(Socket.java:434)
	at java.net.Socket.<init>(Socket.java:211)
	at com.microsoft.ml.spark.TrainUtils$.getNodes(TrainUtils.scala:164)
	at com.microsoft.ml.spark.TrainUtils$$anonfun$4.apply(TrainUtils.scala:195)
	at com.microsoft.ml.spark.TrainUtils$$anonfun$4.apply(TrainUtils.scala:189)
	at com.microsoft.ml.spark.StreamUtilities$.using(StreamUtilities.scala:29)
	at com.microsoft.ml.spark.TrainUtils$.trainLightGBM(TrainUtils.scala:188)
	at com.microsoft.ml.spark.LightGBMRegressor$$anonfun$1.apply(LightGBMRegressor.scala:77)
	at com.microsoft.ml.spark.LightGBMRegressor$$anonfun$1.apply(LightGBMRegressor.scala:77)
	at org.apache.spark.sql.execution.MapPartitionsExec$$anonfun$6.apply(objects.scala:196)
	at org.apache.spark.sql.execution.MapPartitionsExec$$anonfun$6.apply(objects.scala:193)
	at org.apache.spark.rdd.RDD$$anonfun$mapPartitionsInternal$1$$anonfun$apply$25.apply(RDD.scala:827)
	at org.apache.spark.rdd.RDD$$anonfun$mapPartitionsInternal$1$$anonfun$apply$25.apply(RDD.scala:827)
	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:323)
	at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:323)
	at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
	at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
	at org.apache.spark.scheduler.Task.run(Task.scala:108)
	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:338)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Driver stacktrace:
18/05/16 08:46:17 INFO DAGScheduler: Job 6 failed: reduce at LightGBMRegressor.scala:79, took 5030.156772 s
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.spark.deploy.worker.DriverWrapper$.main(DriverWrapper.scala:58)
	at org.apache.spark.deploy.worker.DriverWrapper.main(DriverWrapper.scala)
Caused by: org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 12.0 failed 4 times, most recent failure: Lost task 0.3 in stage 12.0 (TID 1490, 172.33.8.149, executor 0): java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at java.net.Socket.connect(Socket.java:538)
	at java.net.Socket.<init>(Socket.java:434)
	at java.net.Socket.<init>(Socket.java:211)
	at com.microsoft.ml.spark.TrainUtils$.getNodes(TrainUtils.scala:164)
	at com.microsoft.ml.spark.TrainUtils$$anonfun$4.apply(TrainUtils.scala:195)
	at com.microsoft.ml.spark.TrainUtils$$anonfun$4.apply(TrainUtils.scala:189)
	at com.microsoft.ml.spark.StreamUtilities$.using(StreamUtilities.scala:29)
	at com.microsoft.ml.spark.TrainUtils$.trainLightGBM(TrainUtils.scala:188)
	at com.microsoft.ml.spark.LightGBMRegressor$$anonfun$1.apply(LightGBMRegressor.scala:77)
	at com.microsoft.ml.spark.LightGBMRegressor$$anonfun$1.apply(LightGBMRegressor.scala:77)
	at org.apache.spark.sql.execution.MapPartitionsExec$$anonfun$6.apply(objects.scala:196)
	at org.apache.spark.sql.execution.MapPartitionsExec$$anonfun$6.apply(objects.scala:193)
	at org.apache.spark.rdd.RDD$$anonfun$mapPartitionsInternal$1$$anonfun$apply$25.apply(RDD.scala:827)
	at org.apache.spark.rdd.RDD$$anonfun$mapPartitionsInternal$1$$anonfun$apply$25.apply(RDD.scala:827)
	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:323)
	at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:323)
	at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
	at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
	at org.apache.spark.scheduler.Task.run(Task.scala:108)
	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:338)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Driver stacktrace:
	at org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1517)
	at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1505)
	at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1504)
	at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
	at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
	at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:1504)
	at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:814)
	at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:814)
	at scala.Option.foreach(Option.scala:257)
	at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:814)
	at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.doOnReceive(DAGScheduler.scala:1732)
	at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1687)
	at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1676)
	at org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:48)
	at org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:630)
	at org.apache.spark.SparkContext.runJob(SparkContext.scala:2029)
	at org.apache.spark.SparkContext.runJob(SparkContext.scala:2126)
	at org.apache.spark.rdd.RDD$$anonfun$reduce$1.apply(RDD.scala:1026)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
	at org.apache.spark.rdd.RDD.withScope(RDD.scala:362)
	at org.apache.spark.rdd.RDD.reduce(RDD.scala:1008)
	at org.apache.spark.sql.Dataset.reduce(Dataset.scala:1453)
	at com.microsoft.ml.spark.LightGBMRegressor.train(LightGBMRegressor.scala:79)
	at com.microsoft.ml.spark.LightGBMRegressor.train(LightGBMRegressor.scala:36)
	at org.apache.spark.ml.Predictor.fit(Predictor.scala:118)

Caused by: java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at java.net.Socket.connect(Socket.java:538)
	at java.net.Socket.<init>(Socket.java:434)
	at java.net.Socket.<init>(Socket.java:211)
	at com.microsoft.ml.spark.TrainUtils$.getNodes(TrainUtils.scala:164)
	at com.microsoft.ml.spark.TrainUtils$$anonfun$4.apply(TrainUtils.scala:195)
	at com.microsoft.ml.spark.TrainUtils$$anonfun$4.apply(TrainUtils.scala:189)
	at com.microsoft.ml.spark.StreamUtilities$.using(StreamUtilities.scala:29)
	at com.microsoft.ml.spark.TrainUtils$.trainLightGBM(TrainUtils.scala:188)
	at com.microsoft.ml.spark.LightGBMRegressor$$anonfun$1.apply(LightGBMRegressor.scala:77)
	at com.microsoft.ml.spark.LightGBMRegressor$$anonfun$1.apply(LightGBMRegressor.scala:77)
	at org.apache.spark.sql.execution.MapPartitionsExec$$anonfun$6.apply(objects.scala:196)
	at org.apache.spark.sql.execution.MapPartitionsExec$$anonfun$6.apply(objects.scala:193)
	at org.apache.spark.rdd.RDD$$anonfun$mapPartitionsInternal$1$$anonfun$apply$25.apply(RDD.scala:827)
	at org.apache.spark.rdd.RDD$$anonfun$mapPartitionsInternal$1$$anonfun$apply$25.apply(RDD.scala:827)
	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:323)
	at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:323)
	at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
	at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
	at org.apache.spark.scheduler.Task.run(Task.scala:108)
	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:338)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
18/05/16 08:46:17 INFO SparkContext: Invoking stop() from shutdown hook
18/05/16 08:46:17 INFO SparkUI: Stopped Spark web UI at http://172.33.8.149:4040
18/05/16 08:46:17 INFO StandaloneSchedulerBackend: Shutting down all executors
18/05/16 08:46:17 INFO CoarseGrainedSchedulerBackend$DriverEndpoint: Asking each executor to shut down
18/05/16 08:46:17 INFO MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped!
18/05/16 08:46:18 INFO MemoryStore: MemoryStore cleared
18/05/16 08:46:18 INFO BlockManager: BlockManager stopped
18/05/16 08:46:18 INFO BlockManagerMaster: BlockManagerMaster stopped
18/05/16 08:46:18 INFO OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped!
18/05/16 08:46:18 INFO SparkContext: Successfully stopped SparkContext
18/05/16 08:46:18 INFO ShutdownHookManager: Shutdown hook called
18/05/16 08:46:18 INFO ShutdownHookManager: Deleting directory /tmp/spark-d78897cd-3222-44e8-a6f3-e28a7d21b80e

Maybe some timing issue?

As a side note:

  • we are running on m5.24xlarge instance
  • we use spark 2.2.1
  • we are running in standalone cluster mode
  • often the driver is running on the same node as the executor(s)

troszok avatar May 16 '18 09:05 troszok

@troszok would you be able to send me the yarnui logs as well from the driver? I have a bunch of debugging printed there. Based on the stack trace it looks like there is a connection failure here: https://github.com/Azure/mmlspark/blob/02642ce4fd1fc447d5e25e30e6a64d0b845da4f1/src/lightgbm/src/main/scala/TrainUtils.scala#L164 This is where we are connecting from the executors to the main driver. It's interesting that this is an intermittent issue. I wonder if it is related to the timeout I added to the PR. I'll try and repro the issue, but if you can send me the yarnui logs I think that could help me understand the issue better too.

imatiach-msft avatar May 16 '18 14:05 imatiach-msft

@imatiach-msft looks like increasing the timeout helped in our case. Thanks alot.

My first tests - single executor 96cores (m5.24xlarge) show that we are using more CPU but I suppose there is still something not optimal: screen shot 2018-05-20 at 09 21 47

So in total we use >60% of the CPU but ~30% is CPU User (so I assume the real LightGBM training) and and another 30% is lost in the kernel space. There is no disk or network activity so I am wondering what it could be? Context switches? Do you have similar results or is something specific to our installation?

In case of xgboost we achieve 60-70% User CPU usage (and only 1-2% is taken by the OS).

troszok avatar May 20 '18 11:05 troszok

@troszok we shouldn't be underutilizing the CPUs, I wonder if we are still not using all 96 CPUs in your cluster configuration? Would you be able to send me your YARN UI logs (if you are using YARN), we print out debug for each task per executor that establishes a connection to the driver, so I should be able to tell if all CPUs are used.

imatiach-msft avatar May 24 '18 03:05 imatiach-msft

@imatiach-msft since we started playing with the training params we succeeded to have higher load (for the same data and partitioning). The user space is using ~50% and the system is using only 10-15%:

These are the params I used today:

      .setBaggingFraction(0.8)
      .setFeatureFraction(0.8)
      .setMaxBin(1024)
      .setBaggingFreq(1)
      .setBaggingSeed(1)
      .setMaxDepth(30)
      .setMinSumHessianInLeaf(5000)
      .setLabelCol(labelCol)
      .setApplication("regression_l2")
      .setFeaturesCol(featuresColumn)
      .setNumIterations(num_iterations)
      .setNumLeaves(216)
      .setTimeout(300)
      .setLearningRate(0.01)
      .setPredictionCol(predCol)

and got this:

screen shot 2018-05-25 at 14 23 46

This is pretty comparable to what we are getting from xgboost. I am also not sure if the reported load is not caused by the difference of vCPU vs real CPU on AWS (and AFAIK LightGBM needs the latter, while 96 is number of vCPU).

About the logs: We are using spark-standalone in cluster mode and this is logs from our driver: https://gist.githubusercontent.com/troszok/cb9e947c4fb602a8860d1948c7e51997/raw/3203abe6578e09e816b8a7ebb05a90171a75605f/lightgbm_driverr.logs

As far as I can see everything is good there.

So again - thank you very much and let me know if you would like me to run some other tests

troszok avatar May 25 '18 13:05 troszok

@troszok this is great to hear! I took a look at the logs and they look good to me, I see that there were 95 workers connecting to the driver. Mainly, I was looking for these strings where the driver is getting information about socket connections from workers:

18/05/25 12:01:05 INFO LightGBMRegressor: driver received socket from worker: 172.33.4.151:12404 18/05/25 12:01:05 INFO LightGBMRegressor: driver accepting a new connection... 18/05/25 12:01:05 INFO LightGBMRegressor: driver received socket from worker: 172.33.4.151:12443

And then this here where driver is writing all of the network connections needed for LightGBM's network_init call for the 95 workers:

18/05/25 12:01:05 INFO LightGBMRegressor: driver writing back to all connections: 172.33.4.151:12404,172.33.4.151:12443,172.33.4.151:12415,172.33.4.151:12463,172.33.4.151:12418,172.33.4.151:12452,172.33.4.151:12414,172.33.4.151:12481,172.33.4.151:12401,172.33.4.151:12400,172.33.4.151:12409,172.33.4.151:12433,172.33.4.151:12427,172.33.4.151:12410,172.33.4.151:12484,172.33.4.151:12448,172.33.4.151:12444,172.33.4.151:12473,172.33.4.151:12451,172.33.4.151:12462,172.33.4.151:12432,172.33.4.151:12487,172.33.4.151:12436,172.33.4.151:12403,172.33.4.151:12402,172.33.4.151:12417,172.33.4.151:12459,172.33.4.151:12477,172.33.4.151:12408,172.33.4.151:12429,172.33.4.151:12447,172.33.4.151:12421,172.33.4.151:12450,172.33.4.151:12492,172.33.4.151:12416,172.33.4.151:12425,172.33.4.151:12439,172.33.4.151:12440,172.33.4.151:12441,172.33.4.151:12437,172.33.4.151:12407,172.33.4.151:12442,172.33.4.151:12430,172.33.4.151:12471,172.33.4.151:12438,172.33.4.151:12467,172.33.4.151:12446,172.33.4.151:12456,172.33.4.151:12486,172.33.4.151:12475,172.33.4.151:12458,172.33.4.151:12491,172.33.4.151:12464,172.33.4.151:12482,172.33.4.151:12431,172.33.4.151:12420,172.33.4.151:12412,172.33.4.151:12428,172.33.4.151:12493,172.33.4.151:12485,172.33.4.151:12434,172.33.4.151:12454,172.33.4.151:12445,172.33.4.151:12422,172.33.4.151:12470,172.33.4.151:12453,172.33.4.151:12455,172.33.4.151:12480,172.33.4.151:12474,172.33.4.151:12406,172.33.4.151:12488,172.33.4.151:12457,172.33.4.151:12413,172.33.4.151:12461,172.33.4.151:12466,172.33.4.151:12449,172.33.4.151:12490,172.33.4.151:12460,172.33.4.151:12483,172.33.4.151:12435,172.33.4.151:12469,172.33.4.151:12411,172.33.4.151:12405,172.33.4.151:12479,172.33.4.151:12468,172.33.4.151:12423,172.33.4.151:12419,172.33.4.151:12465,172.33.4.151:12476,172.33.4.151:12478,172.33.4.151:12489,172.33.4.151:12472,172.33.4.151:12424,172.33.4.151:12426,172.33.4.151:12494 18/05/25 12:01:05 INFO LightGBMRegressor: driver closing all sockets and server socket

imatiach-msft avatar May 25 '18 16:05 imatiach-msft