{"id":27944777,"url":"https://github.com/udst/manta","last_synced_at":"2025-05-07T12:54:29.791Z","repository":{"id":40956537,"uuid":"269509159","full_name":"UDST/manta","owner":"UDST","description":"Microsimulation Analysis for Network Traffic Assignment","archived":false,"fork":false,"pushed_at":"2023-10-03T22:21:51.000Z","size":106930,"stargazers_count":16,"open_issues_count":6,"forks_count":4,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-04-16T05:28:48.718Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UDST.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-05T02:09:40.000Z","updated_at":"2023-02-10T14:36:55.000Z","dependencies_parsed_at":"2023-02-16T09:00:41.808Z","dependency_job_id":null,"html_url":"https://github.com/UDST/manta","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UDST%2Fmanta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UDST%2Fmanta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UDST%2Fmanta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UDST%2Fmanta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UDST","download_url":"https://codeload.github.com/UDST/manta/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252882817,"owners_count":21819153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-07T12:54:29.013Z","updated_at":"2025-05-07T12:54:29.776Z","avatar_url":"https://github.com/UDST.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# manta\n\nMicrosimulation Analysis for Network Traffic Assignment. MANTA employs a highly parallelized GPU implementation that is fast enough to run simulations on large-scale demand and networks within a few minutes - metropolitan and regional scale with hundreds of thousands of nodes and edges and millions of trips. We test our platform to simulate the entire Bay Area metropolitan region over the course of the morning using half-second time steps. The runtime for the nine-county Bay Area simulation is just over four minutes, not including routing and initialization. This computational performance significantly improves state of the art in large-scale traffic microsimulation and offers new capacity for analyzing the detailed travel patterns and travel choices of individuals for infrastructure planning and emergency management.\n\n![](https://github.com/UDST/manta/blob/main/bay_bridge_trips.png)\n\n## Initial checks\n\n```bash\nsudo apt update\nsudo apt install qtchooser\nsudo apt-get install qt5-default\nsudo apt-get install libglew-dev\nsudo apt-get install build-essential\nsudo apt-get install libfontconfig1\nsudo apt-get install mesa-common-dev\nsudo apt-get install wget\nsudo apt-get install pciutils\nsudo apt install git\n```\n\n## Dependencies\n\n - Boost 1.59 \n ```bash \n wget http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz\n sudo tar xf boost_1_59_0.tar.gz -C /usr/local\n ```\n \n - CUDA (used versions: 9.0 in Ubuntu) (If you are using Google Cloud Platform, please follow these [instructions](https://cloud.google.com/compute/docs/gpus/install-drivers-gpu#ubuntu-driver-steps))\n - g++ (used versions: 6.4.0 in Ubuntu)\n - Qt5 (used versions: 5.9.5 in Ubuntu)\n - qmake (used versions: 3.1 in Ubuntu)\n - Python (used versions: 3.6.5 in Ubuntu)\n - pytest (used versions: 6.1.1 in Ubuntu) \n - pytest-cov (used versions: 2.10.1 in Ubuntu) \n - pytest-remotedata (used versions: 0.3.2 in Ubuntu) \n - psutil (used versions: 5.7.2 in Ubuntu) \n - xlwt (used versions: 1.3.0 in Ubuntu)\n\n## Installation \u0026 Compilation\n\n### Manual installation\n\nOnce the necessary dependencies are installed, you can use the following lines to make sure the\ncorrect versions of each one are used:\n```bash\nexport PATH=/usr/local/cuda-9.0/bin:$PATH\nexport LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LIBRARY_PATH \nexport LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH \nexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/{YOUR_USERNAME}/pandana/src\n```\n\nYou can also add the `export` lines at the end of your user's `~/.bashrc` to\navoid re-entering them in each session.\n\nClone the repo in your home directory with:\n```bash\ngit clone git@github.com:udst/manta.git ~/manta \u0026\u0026 cd ~/manta\n```\n\nClone the [Pandana repository](https://github.com/UDST/pandana) to your home directory stay on the `main` branch, since MANTA now uses a fast contraction hierarchies framework for shortest path routing. Previously implemented shortest path frameworks include Johnson's all pairs shortest path and a parallelized Dijkstra's priority queue.\n\nCreate `Makefile` and compile with:\n```bash\nsudo qmake LivingCity/LivingCity.pro\n```\n\nImportantly, because MANTA uses a shared library from Pandana, a Pandana makefile must be created (to create a shared object file) and the MANTA makefile must be modified.\n\nPandana `Makefile`:\n\n1. Create Makefile in `pandana/src/` containing the following:\n\n```# Makefile for pandana C++ contraction hierarchy library\n\nCC = gcc  # C compiler\nCXX = g++\nCPPFLAGS = -DLINUX -DMAC -std=c++0x -c -fPIC -g -O3 -Wall -pedantic -fopenmp  # C flags\nLDFLAGS = -shared   # linking flags\nRM = rm -f   # rm command\nTARGET_LIB = libchrouting.so  # target lib\n\nSRCS =  accessibility.cpp graphalg.cpp contraction_hierarchies/src/libch.cpp\n\nOBJS = $(SRCS:.cpp=.o)\n\n.PHONY: all\nall: ${TARGET_LIB}\n\n$(TARGET_LIB): $(OBJS)\n        $(CXX) ${LDFLAGS} -o $@ $^\n\n.PHONY: clean\nclean:\n        -${RM} ${TARGET_LIB} ${OBJS}\n```\n2. Run `make`.\n\nMANTA `Makefile`:\n\n1. Add `-I/home/{YOUR_USERNAME}/pandana/src` to `INCPATH`.\n2. Add `-L/home/{YOUR_USERNAME}/pandana/src -lchrouting` to `LIBS`.\n3. Run `sudo make -j`.\n\n\n### Run with Docker\n\n1.  Make sure that you have Docker, its NVidia container toolkit and the necessary permissions:\n```bash\nsudo apt install docker.io\nsudo groupadd docker\nsudo usermod -aG docker {YOUR_USERNAME}\nsudo apt-get install -y nvidia-container-toolkit\n```\n\n2. You can either pull and run our built image\n```bash\ndocker pull gcr.io/blissful-jet-303616/manta:latest\ndocker run -it --rm --gpus all -v \"$PWD\":/manta -w /manta gcr.io/blissful-jet-303616/manta:latest  bash\n```\nOr build it yourself\n```bash\ndocker build -t manta:latest .\ndocker run -it --rm --gpus all -v \"$PWD\":/manta -w /manta manta:latest bash\n```\n\n3. Once inside the container, compile and run\n```bash\nqmake LivingCity/LivingCity.pro\nmake\ncd LivingCity\n./LivingCity\n```\n\n## Data\n\nBefore running everything, you need the appropriate data:\n\n1. Network\n2. Demand\n\nThe networks currently reside in `manta/LivingCity/berkeley_2018`, and the default directory is the full SF Bay Area network in `new_full_network/`. This contains the `nodes.csv` and `edges.csv` files to create the network.\n\nThe demand is not in `new_full_network/`, but needs to reside there in order to run it. Please contact [Pavan Yedavalli](pavyedav@gmail.com) to procure real or sample demands.\n\n## Running\n\nIf you wish to edit the microsimulation configuration, modify `manta/LivingCity/command_line_options.ini`, which contains the following:\n\n```[General]\nGUI=false\nUSE_CPU=false\nNETWORK_PATH=berkeley_2018/new_full_network/\nUSE_JOHNSON_ROUTING=false\nUSE_SP_ROUTING=true\nUSE_PREV_PATHS=true\nLIMIT_NUM_PEOPLE=256000\nADD_RANDOM_PEOPLE=false\nNUM_PASSES=1\nTIME_STEP=0.5\nSTART_HR=5\nEND_HR=12\n```\n\nHere, you can modify the:\n\n1. `GUI` - deprecated. Do not touch.\n2. `USE_CPU` - deprecated. Do not touch.\n3. `NETWORK_PATH` - specific path to the network files. Default is `berkeley_2018/new_full_network/`.\n4. `USE_JOHNSON_ROUTING` - uses Johnson's all pairs shortest path routing. This should always be set to `false`.\n5. `USE_SP_ROUTING` - uses new SP routing framework. This should always be set to `true`.\n6. `USE_PREV_PATHS` - uses paths already produced and saved to file. Set to `false` if running for the first time. Set to `true` if the simulation was already run and it was saved to file. \n7. `LIMIT_NUM_PEOPLE` - deprecated. Do not touch.\n8. `ADD_RANDOM_PEOPLE` - deprecated. Do not touch.\n9. `NUM_PASSES` - the number of times the simulation is run. Set to 1.\n10. `TIME_STEP` - timestep. Default is .5 seconds.\n11. `START_HR` - start hour of the simulation. Default is 5am.\n12. `END_HR` - end hour of the simulation. Default is 12pm.\n\nRun with:\n```bash\ncd LivingCity\n./LivingCity\n```\n\n## Development\n\nShould you wish to make any changes, please create a new branch. In addition, once the original Makefile is created, you can simply run `sudo make -j` from the `manta/` directory to compile any new changes.\n\nIf necessary, you can checkout a different existing branch from main (`edge_speeds_over_time`, for instance):\n```bash\ngit checkout edge_speeds_over_time\n```\n\n### Debugging\nFor debugging we recommend `cuda-memcheck ./LivingCity` for out-of-bounds memory bugs in the CUDA section and `cuda-gdb` for more advanced features such as breakpoints.\n\nIn order to use `cuda-gdb`, `manta/Makefile` must be modified by adding the flag `-G` to enable debugging and changing `-O3` to `-O` to avoid optimizations that restrict the use of the debugger.\n\nFor example, to enable debugging at `LivingCity/traffic/b18CUDA_trafficSimulator.cu`,  its compilation at the line `manta/Makefile:1756`:\n\u003cpre\u003e\n/usr/local/cuda-9.0/bin/nvcc -m64 \u003cb\u003e-O3\u003c/b\u003e -arch=sm_50 -c --compiler-options -f\nno-strict-aliasing -use_fast_math --ptxas-options=-v -Xcompiler -fopenmp -I/u\nsr/include/opencv2/ -I/opt/local/include/ -I/usr/local/boost_1_59_0/ -I/home/\n\u003cb\u003e{YOUR_USERNAME}\u003c/b\u003e/manta/LivingCity/glew/include/ -I/usr/local/cuda-9.0/include  -L/opt/l\nocal/lib -lopencv_imgcodecs -lopencv_core -lopencv_imgproc -lcudart -lcuda -g -lgomp\nLivingCity/traffic/b18CUDA_trafficSimulator.cu -o\n${OBJECTS_DIR}b18CUDA_trafficSimulator_cuda.o\n\u003c/pre\u003e\n\nmust be modified to:\n\u003cpre\u003e\n/usr/local/cuda-9.0/bin/nvcc -m64 \u003cb\u003e-O\u003c/b\u003e -arch=sm_50 -c --compiler-options -f\nno-strict-aliasing -use_fast_math --ptxas-options=-v -Xcompiler -fopenmp -I/u\nsr/include/opencv2/ -I/opt/local/include/ -I/usr/local/boost_1_59_0/ -I/home/\n\u003cb\u003e{YOUR_USERNAME}\u003c/b\u003e/manta/LivingCity/glew/include/ -I/usr/local/cuda-9.0/include  -L/opt/l\nocal/lib -lopencv_imgcodecs -lopencv_core -lopencv_imgproc -lcudart -lcuda -g \u003cb\u003e-G\u003c/b\u003e\n-lgomp LivingCity/traffic/b18CUDA_trafficSimulator.cu -o\n${OBJECTS_DIR}b18CUDA_trafficSimulator_cuda.o\n\u003c/pre\u003e\n\nAfter this modification, `sudo make clean` and `sudo make -j` must be run.\n\nPlease keep in mind that this alteration slows the program down. For more information about `cuda-gdb`, please refer to the official [Website](https://docs.nvidia.com/cuda/cuda-gdb/index.html) and [Documentation](https://www.google.com/url?sa=t\u0026rct=j\u0026q=\u0026esrc=s\u0026source=web\u0026cd=\u0026ved=2ahUKEwiBgbqg9fzrAhUMIrkGHby9Db8QFjADegQIAxAB\u0026url=https%3A%2F%2Fdeveloper.download.nvidia.com%2Fcompute%2FDevZone%2Fdocs%2Fhtml%2FC%2Fdoc%2Fcuda-gdb.pdf\u0026usg=AOvVaw3J9Il2vHkkxtcX83EHC3-z).\n\n### Testing\nIn order to run all tests you should first move to `manta/LivingCity`\n```bash\ncd LivingCity\n```\nand then run \n```bash\nsh runAllTests.sh\n```\n\n### Benchmarking / profiling\nIn order to obtain a profiling of each component of the simulation, you should run\n```bash\npython3 LivingCity/benchmarking/runBenchmarks.py\n```\n\nIf you wish to specify the name of the benchmark outputs and/or the number of iterations, just run:\n```bash\npython3 LivingCity/benchmarking/runBenchmarks.py --name={name_of_benchmark} --runs={number_of_iterations_to_run}\n```\nThe script will run LivingCity the specified number of times while polling the system resources. For each component, its resource and time consumption will be saved into a `csv` file, a plot and a `xls` file in `manta/LivingCity/benchmarking/`. The profiling of each version is encouraged to be stored in [here](https://docs.google.com/spreadsheets/d/14KCUY8vLp9HoLuelYC5DmZwKI7aLsiaNFp7e6Z8bVBU/edit?usp=sharing).\n\nVersions correspond to [the repository's tags](https://github.com/UDST/manta/tags). In order to create a new tag, just run\n```bash\ngit tag v0.x.0\ngit push --tags\n```\n\n\n## Acknowledgments\n\nThis repository and code have been developed and maintained by Pavan Yedavalli, Ignacio Garcia Dorado, Krishna Kumar, and Paul Waddell. This work heavily derives from Ignacio Garcia Dorado's [Automatic Urban Modeling project](http://www.ignaciogarciadorado.com/p/2014_EG/2014_EG.html).\n\nIf this code is used in any shape or form for your project, please cite this paper accordingly:\n\nP. Yedavalli, K. Kumar, and P. Waddell, “Microsimulation Analysis for Network Traffic Assignment (MANTA) at Metropolitan-Scale for Agile Transportation Planning,” arXiv:2007.03614 [physics], Jul. 2020, Available: http://arxiv.org/abs/2007.03614.\n\nThank you!\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fudst%2Fmanta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fudst%2Fmanta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fudst%2Fmanta/lists"}