Uh oh!
There was an error while loading. Please reload this page.
Automatically drop unneeded columns in choosers table - #833
Conversation
i-am-sijia
commented
Mar 26, 2024
Note that when dropping columns in pandas df, the memory actually goes up momentarily before it goes down. see discussion here pandas-dev/pandas#17092, this issue was "closed" but it did not get resolved. Looking at my code changes last week, I realized I was also dropping the columns a bit too late for interaction simulate models. The columns should be dropped before interaction df is created. I then made those changes. Below shows the 1-zone benchmarking runs with main branch (top) and with this PR (bottom). In the non-sharrow mode, the peak memory went down from 352 GB to 261 GB, a 25% reduction. Component-wise memory reduction, sorted by memory saving: I'm still dealing with some crashes in the sharrow mode. |
jpn--
commented
Mar 26, 2024
If you read the thread closely, you'll note that that "this is not going to be solved in pandas 1." The behind-the-curtain memory management of pandas 1.x doesn't offer any way to drop unused columns without consuming extra RAM. This is alleviated by moving to pandas 2... after the transition, there are now ways to get the memory benefit. This is (part of) the reason I've worked this past week to try to get us pandas-2 compatible. |
i-am-sijia
commented
Apr 1, 2024
I have some updates for the Sharrow runs. Below are three 1-zone benchmarking runs with Sharrow. The one on the top (3/20) used the
|
Uh oh!
There was an error while loading. Please reload this page.
Update RE:
This seems to be because flow.load time increased. For example, in the 3/20 run: 18/03/202419:27:38.294-INFO-sharrow-flowexistsinlibrary: BJFBKLAOJGCDYZF4MKEWTG744CT3JZF218/03/202419:27:38.294-INFO-activitysim.core.flow-completedsettingupflowschool_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsumsin0:00:00.07700018/03/202419:27:38.294-INFO-activitysim.core.flow-beginflow_BJFBKLAOJGCDYZF4MKEWTG744CT3JZF2.loadschool_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsums18/03/202419:30:05.321-INFO-activitysim.core.flow-completedflow_BJFBKLAOJGCDYZF4MKEWTG744CT3JZF2.loadin0:02:27.026987school_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsums18/03/202419:30:05.321-INFO-activitysim.core.flow-completedapply_flowin0:02:27.103988 ...
18/03/202420:09:15.654-INFO-activitysim.core.flow-settingupsharrowflowvehicle_type_choice.interaction_simulate.interaction_simulate.eval_interaction_utils18/03/202420:09:15.995-INFO-sharrow-usingexistingflowcode736GLJ6FZR4AF6ZTRFF5NB4F2D2MYM7X18/03/202420:09:16.193-INFO-activitysim.core.flow-completedsettingupflowvehicle_type_choice.interaction_simulate.interaction_simulate.eval_interaction_utilsin0:00:00.55200118/03/202420:09:16.193-INFO-activitysim.core.flow-beginflow_736GLJ6FZR4AF6ZTRFF5NB4F2D2MYM7X.loadvehicle_type_choice.interaction_simulate.interaction_simulate.eval_interaction_utils18/03/202420:13:04.941-INFO-activitysim.core.flow-completedflow_736GLJ6FZR4AF6ZTRFF5NB4F2D2MYM7X.loadin0:03:48.747827vehicle_type_choice.interaction_simulate.interaction_simulate.eval_interaction_utils18/03/202420:13:04.941-INFO-activitysim.core.flow-completedapply_flowin0:03:49.299828 ...In the 3/29 run: 29/03/202417:41:59.160-INFO-sharrow-flowexistsinlibrary: BJFBKLAOJGCDYZF4MKEWTG744CT3JZF229/03/202417:41:59.160-INFO-activitysim.core.flow-completedsettingupflowschool_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsumsin0:00:00.07813929/03/202417:41:59.160-INFO-activitysim.core.flow-beginflow_BJFBKLAOJGCDYZF4MKEWTG744CT3JZF2.loadschool_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsums29/03/202417:53:31.208-INFO-activitysim.core.flow-completedflow_BJFBKLAOJGCDYZF4MKEWTG744CT3JZF2.loadin0:11:32.047284school_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsums29/03/202417:53:31.208-INFO-activitysim.core.flow-completedapply_flowin0:11:32.125423 ...
29/03/202419:11:49.595-INFO-activitysim.core.flow-settingupsharrowflowvehicle_type_choice.interaction_simulate.interaction_simulate.eval_interaction_utils29/03/202419:11:49.924-INFO-sharrow-usingexistingflowcode736GLJ6FZR4AF6ZTRFF5NB4F2D2MYM7X29/03/202419:11:49.955-INFO-activitysim.core.flow-completedsettingupflowvehicle_type_choice.interaction_simulate.interaction_simulate.eval_interaction_utilsin0:00:00.39058029/03/202419:11:49.955-INFO-activitysim.core.flow-beginflow_736GLJ6FZR4AF6ZTRFF5NB4F2D2MYM7X.loadvehicle_type_choice.interaction_simulate.interaction_simulate.eval_interaction_utils29/03/202419:21:27.151-INFO-activitysim.core.flow-completedflow_736GLJ6FZR4AF6ZTRFF5NB4F2D2MYM7X.loadin0:09:37.196634vehicle_type_choice.interaction_simulate.interaction_simulate.eval_interaction_utils29/03/202419:21:27.151-INFO-activitysim.core.flow-completedapply_flowin0:09:37.587213 ...Not sure if this is because of recent sharrow updates, or because of recent updates in the way unused columns are dropped. |
jpn--
commented
Apr 11, 2024
I am not sure what is happening that has cause the code to run slower for @i-am-sijia , I am unable to replicate the problem. I have run the full scale model on my laptop through school location choice (the first problematic model shown above) and got these results: sharrow commit 7fae9f060b77684b2f309c9ad2ad3d2bf3286239 (sharrow as of 3/28) sharrow commit c560b45f0e1cd5ccbb871319b5ccfbcf789debaf (sharrow v2.7, in use 3/20) |
jpn--
commented
Apr 16, 2024
I recall we discussed that we would like to have a method to turn this feature off for individual components, either because it is interfering with something (e.g. tracing, estimation mode) or just because it's not working on a particular component (probably due to something weird in the spec). I do see that it turns itself off when tracing or estimation mode is used, which is OK, but I think we still want the capability to turn it off manually if desired. |
I reran the reported "3/20" and "3/29" runs, see Test 1 and Test 2 below. Last time they were run on different machines. This time they are run on the same machine. Good news is that this time I'm not seeing a huge runtime difference. Test 3 uses the same commits as one of Jeff's test, apparently the run time on Win is longer than Mac. Test 1 (Rerunning the "3/20" run)Sharrow commit c560b45f0e1cd5ccbb871319b5ccfbcf789debaf (sharrow v2.7) 16/04/202413:41:49.585-INFO-sharrow-flowexistsinlibrary: BJFBKLAOJGCDYZF4MKEWTG744CT3JZF216/04/202413:41:49.587-INFO-activitysim.core.flow-completedsettingupflowschool_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsumsin0:00:00.11417416/04/202413:41:49.587-INFO-activitysim.core.flow-beginflow_BJFBKLAOJGCDYZF4MKEWTG744CT3JZF2.loadschool_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsums16/04/202413:49:11.177-INFO-activitysim.core.flow-completedflow_BJFBKLAOJGCDYZF4MKEWTG744CT3JZF2.loadin0:07:21.590254school_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsums16/04/202413:49:11.177-INFO-activitysim.core.flow-completedapply_flowin0:07:21.704428Test 2 (Rerunning the "3/29" run)Sharrow commit c560b45f0e1cd5ccbb871319b5ccfbcf789debaf (sharrow v2.7) 12/04/202420:47:53.356-INFO-sharrow-flowexistsinlibrary: BJFBKLAOJGCDYZF4MKEWTG744CT3JZF212/04/202420:47:53.356-INFO-activitysim.core.flow-completedsettingupflowschool_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsumsin0:00:00.07812812/04/202420:47:53.356-INFO-activitysim.core.flow-beginflow_BJFBKLAOJGCDYZF4MKEWTG744CT3JZF2.loadschool_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsums12/04/202420:56:44.189-INFO-activitysim.core.flow-completedflow_BJFBKLAOJGCDYZF4MKEWTG744CT3JZF2.loadin0:08:50.832949school_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsums12/04/202420:56:44.189-INFO-activitysim.core.flow-completedapply_flowin0:08:50.911078Test 3 (use the latest sharrow)Sharrow commit 7fae9f060b77684b2f309c9ad2ad3d2bf3286239 (sharrow v2.8.2 as of 3/28) 15/04/202413:55:03.917-INFO-sharrow-flowexistsinlibrary: BJFBKLAOJGCDYZF4MKEWTG744CT3JZF215/04/202413:55:03.917-INFO-activitysim.core.flow-completedsettingupflowschool_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsumsin0:00:00.08288215/04/202413:55:03.917-INFO-activitysim.core.flow-beginflow_BJFBKLAOJGCDYZF4MKEWTG744CT3JZF2.loadschool_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsums15/04/202414:01:53.135-INFO-activitysim.core.flow-completedflow_BJFBKLAOJGCDYZF4MKEWTG744CT3JZF2.loadin0:06:49.217218school_location.i1.logsums.gradeschool.compute_logsums.eval_nl_logsums15/04/202414:01:53.135-INFO-activitysim.core.flow-completedapply_flowin0:06:49.300100 |
@jpn-- , I made the key code changes needed for turning this feature on and off for individual components, I haven't pushed them. It's essentially passing a Boolean Then I paused and read your latest comment on #824. Since you are generalizing the |
jpn--
commented
Apr 18, 2024
I like this idea. Let's finish the review/merge of #824 and then it should be easy to update this PR and put this straight into the |
i-am-sijia
commented
Apr 21, 2024
@jpn-- , I implemented I tested setting |



This PR addresses #792