Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local install (non Docker) causing Storage to fill up #53

Open
anciltech opened this issue Sep 18, 2021 · 18 comments
Open

Local install (non Docker) causing Storage to fill up #53

anciltech opened this issue Sep 18, 2021 · 18 comments

Comments

@anciltech
Copy link

I ran the "pip install ." with the setup.py and all other files in the working directory of Python, and my Mac started asking me for permission to access Photos, Contacts etc, witch I found odd, and noticed that the write speed to my local storage was very high and filling up my SSD. I terminated the code and only had a few gigs left on the drive. After a restart the storage returned back to where it was before I attempted the install. What the heck is all that about? Im new to python, but I dont think I did anything that drastically wrong. I have been working with the docker version beforehand, but wanted to see if there was any better performance in the undockerized version.

@ChHarding
Copy link
Owner

ChHarding commented Sep 18, 2021 via email

@anciltech
Copy link
Author

Thanks for the detailed response Chris, it filled up about 150Gb of space so a little bit more than I think a normal install would take ;)

I am using a resin printer to create some cool wall art and gifts, and the printer really capture every triangle face if it isn't high enough quality, ergo large file sizes and running into some of the size limits, I was looking to run the local code for increased performance and hopefully success rate. Sometimes the docker container version will slow if the files are large, until it eventually doesn't show any progress or CPU/GPU resources used; any idea why that is?

Seems like you guys are running quite the rig behind the web version, that'll spit out a 150Gb file size in about 30 seconds where it takes quite a while on my Laptop. Maybe ill stick with that!
Thanks for the tool, this makes things possible that I'd never be able to figure out on my own.

@ChHarding
Copy link
Owner

ChHarding commented Sep 19, 2021 via email

@ChHarding
Copy link
Owner

ChHarding commented Oct 1, 2021 via email

@anciltech
Copy link
Author

Hi Chris, sorry for the long reply time, in the middle of moving at the moment.

Setting the "max_cells_for_memory_only" to 10^20 definitely did help, and I'm using a 4x2 grid to utilize my 8 core processor, then combining and solidifying the models together afterwards with Meshmixer.

I am still able to get it to get TT stuck though, when increasing the resolution further. I am using online DEM data and usually start at a .4 resolution to see how it looks, and then go as far down as I can go with the resolution before running into the TT stall issue, which typically occurs around a 0.1 and a total size of 240x180mm. I just tried setting the resolution to -1 but an error returns with "EEException: Pixel grid dimensions (14210x10725) must be less than or equal to 10000."

As far as the validity of going to such low resolutions, SLA horizontal resolution is 0.05mm and the Z can be set to 0.01mm, which in my experience means that you can really see each face of each triangle from up close, and it makes the print look "out of focus" from further back. Also, steep faces, even with high resolution, can end up coming out jagged (see attached photo of Half Dome face at a resolution of 0.2, log attached for reference). What I've found can help is the Solidify function in Meshmixer, which can help smooth out some of those artifacts while removing leftover edges and structures from the previous 4x2 grid.

What do you think? Am I asking too much?

Screen Shot 2021-10-04 at 14 36 00

Screen Shot 2021-10-04 at 14 25 51

[logfile.txt](https://github.com/ChHarding/TouchTerrain_for_CAGEO/files/7277987/logfile.txt)

@ChHarding
Copy link
Owner

ChHarding commented Oct 4, 2021 via email

@anciltech
Copy link
Author

Hi Chris

I've done some testing over the past day on the different options above to see which would be the best...

  1. Downloading TIF from EE - This also stops in the middle of processing when the file is at a similar resolution to what I've tried before.
    An interesting tangent though, pulling the TIF at the original resolution of 30m (var scale: 30 during export of DSM from JAXA/ALOS/AW3D30/V2_2) results in a far rougher model than setting the resolution to 5m, as shown in the screenshots. How is this possible if the original data is only accurate to 30m?

Screen Shot 2021-10-06 at 13 44 22

Screen Shot 2021-10-06 at 13 44 38

  1. Manually looping with "Only" - This works and seems like the best option at the moment, but is slow, since it only uses one core. Also, Meshmixer is able to remove these inner walls with the Make Solid tool, which works quite well. I am hollowing out my prints to save on resin so I have been doing this after combining.

  2. Using TT to obtain tiled TIFs - I only ran into the 10000 limit when setting the resolution to -1. I dont think Ill need full resolution at any point, but I'll look into this in the future.

About the failure during processing, do you think it could be an issue with the multiprocessing? I was looking through your code a bit and was thinking maybe this synchronization implementation might be the trick ...
https://docs.python.org/3/library/multiprocessing.html#synchronization-between-processes

Thanks for all the help!
Max

PS Ive updated Docker and TT isn't able to start anymore. Ive deleted and reinstalled TT, and tried to Trust the notebook, but it always leads to:
[W 14:29:05.983 NotebookApp]�(B Notebook TouchTerrain_jupyter_for_starters.ipynb is not trusted
Operation not permitted (src/thread.cpp:309)
Operation not permitted (src/thread.cpp:309)
qemu: uncaught target signal 6 (Aborted) - core dumped
./run_touchterrain.sh: line 7: 53 Aborted jupyter notebook --ip 0.0.0.0 --port 8888 --no-browser --allow-root
root@a33de40e914d:/TouchTerrain# Operation not permitted (src/thread.cpp:309)
Operation not permitted (src/thread.cpp:309)
qemu: uncaught target signal 6 (Aborted) - core dumped

@ChHarding
Copy link
Owner

ChHarding commented Oct 6, 2021 via email

@anciltech
Copy link
Author

I did some digging after you said your nb was untrusted as well, and it appears to be a variable name change in a library (See log below). The following ipython-contrib/jupyter_contrib_nbextensions#1529 suggests to downgrade nbconvert to less than v6, although that didn't work, so ill have to go and change the variable names in a few places. I'll give this a shot later and see if it works. Just not sure why this all changed, do you?

Ive been using the same, 127.0.0.1. Always just copy and paste the last link. I usually use safari. I tried Chrome now too with the same result. Ive also tried running pip install --upgrade jupyterlab. It seemed to be directly tied to the Docker update, but I have been installing other things which I dont understand, like conda and some other tools, but nothing in the docker environment.

The following occurs after opening the TouchTerrain_standalone_jupyter_notebook.ipynb file...

[I 14:28:15.440 NotebookApp]�(B 302 GET /?token=eff3b58a32e239fe28397a413c0fca19871795fea0e047ea (172.17.0.1) 8.480000ms
[W 14:29:02.845 NotebookApp]�(B Config option template_path not recognized by ExporterCollapsibleHeadings. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:02.888 NotebookApp]�(B Config option template_path not recognized by ExporterCollapsibleHeadings. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:03.006 NotebookApp]�(B Config option template_path not recognized by TocExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:03.035 NotebookApp]�(B Config option template_path not recognized by TocExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:03.086 NotebookApp]�(B Config option template_path not recognized by LenvsHTMLExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:03.177 NotebookApp]�(B Config option template_path not recognized by LenvsHTMLExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:03.241 NotebookApp]�(B Config option template_path not recognized by LenvsTocHTMLExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:03.288 NotebookApp]�(B Config option template_path not recognized by LenvsTocHTMLExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:03.426 NotebookApp]�(B Config option template_path not recognized by LenvsLatexExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:03.453 NotebookApp]�(B Config option template_path not recognized by LenvsLatexExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:04.015 NotebookApp]�(B Config option template_path not recognized by LenvsSlidesExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:04.045 NotebookApp]�(B Config option template_path not recognized by LenvsSlidesExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:04.369 NotebookApp]�(B Config option template_path not recognized by ExporterCollapsibleHeadings. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:04.407 NotebookApp]�(B Config option template_path not recognized by ExporterCollapsibleHeadings. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:04.520 NotebookApp]�(B Config option template_path not recognized by TocExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:04.548 NotebookApp]�(B Config option template_path not recognized by TocExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:04.589 NotebookApp]�(B Config option template_path not recognized by LenvsHTMLExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:04.636 NotebookApp]�(B Config option template_path not recognized by LenvsHTMLExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:04.696 NotebookApp]�(B Config option template_path not recognized by LenvsTocHTMLExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:04.743 NotebookApp]�(B Config option template_path not recognized by LenvsTocHTMLExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:04.871 NotebookApp]�(B Config option template_path not recognized by LenvsLatexExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:04.898 NotebookApp]�(B Config option template_path not recognized by LenvsLatexExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:05.466 NotebookApp]�(B Config option template_path not recognized by LenvsSlidesExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[W 14:29:05.495 NotebookApp]�(B Config option template_path not recognized by LenvsSlidesExporter. Did you mean one of: extra_template_paths, template_name, template_paths?
[I 14:29:05.975 NotebookApp]�(B Writing notebook-signing key to /root/.local/share/jupyter/notebook_secret
[W 14:29:05.983 NotebookApp]�(B Notebook TouchTerrain_jupyter_for_starters.ipynb is not trusted
Operation not permitted (src/thread.cpp:309)
Operation not permitted (src/thread.cpp:309)
qemu: uncaught target signal 6 (Aborted) - core dumped
./run_touchterrain.sh: line 7: 53 Aborted jupyter notebook --ip 0.0.0.0 --port 8888 --no-browser --allow-root
root@a33de40e914d:/TouchTerrain# Operation not permitted (src/thread.cpp:309)
Operation not permitted (src/thread.cpp:309)
qemu: uncaught target signal 6 (Aborted) - core dumped
exit
root@a33de40e914d:/TouchTerrain# exit

@ChHarding
Copy link
Owner

ChHarding commented Oct 7, 2021 via email

@ChHarding
Copy link
Owner

ChHarding commented Oct 14, 2021 via email

@anciltech
Copy link
Author

Hi Chris, I've been trying to fix this issue but haven't had much luck. I'm pretty new to python, docker and Jupyter, but the closest I've gotten is copied below. The 302 GET is me opening Jupyter link in a browser, and once I click on on of the Notebooks, I get these Operation not permitted errors. Have you run into this before? It might be a M1 Mac issue, as I can't find much about this around google. Just strange that it was working fine before.

[I 17:19:44.124 NotebookApp] 302 GET /?token=e86d032641ca6ba1b98647aa5accc5068d39b4d1cf321213 (172.17.0.1) 6.570000ms
Operation not permitted (src/thread.cpp:309)
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted

Operation not permitted (src/thread.cpp:309)

Operation not permitted (src/thread.cpp:309)
qemu: uncaught target signal 6 (Aborted) - core dumped

@ChHarding
Copy link
Owner

ChHarding commented Oct 24, 2021 via email

@anciltech
Copy link
Author

anciltech commented Oct 26, 2021

Hi Chris, Finally some good news:

Docker Version: I did the obvious and just downgraded Docker from 4.1.1 to 4.0.0, now everything is working (not sure why I didn't just try this first). I noted this issue under the Docker issue docker/for-mac#6016 (comment)

Local Jupyter Version: Great to hear! Let me know if you need any help testing for future releases.
I downloaded v3.5 and gave a local install another try. I had more luck this time, but had to mess around with a import gdal issue (not totally sure how I fixed it, but FYI I received this error after initial setup >>> import gdal return _load(spec) ImportError: dlopen(/Users/Genesis/opt/miniconda3/lib/python3.9/site-packages/osgeo/_gdal.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/libpoppler.91.dylib)

The processing on the local version is much faster for me than the Docker version. At least 2x, which I am loving, and TT has been able to create 700+Mb files with ease, although I am only able to do a single tile. I get an error with multiple tiles. The following error comes after all tiles have been created:

Error sending result: '[({'DEMname': 'JAXA-ALOS-AW3D30-V2_2', 'crs': 'EPSG:32632', 'UTMzone': 'UTM 32N', 'scale': 125122.9924536569, 'pixel_mm': 0.08982035928143713, 'max_elev': 21.29301683616701, 'min_elev': 4.749294859834901, 'z_scale': 1, 'base_thickness_mm': 2, 'bottom_relief_mm': 1.0, 'folder_name': 'V2_2_9.17_46.82', 'tile_centered': False, 'tile_no_x': 2, 'tile_no_y': 1, 'tile_width': 60.0, 'tile_height': 90.9880239520958, 'full_raster_width': 2674, 'full_raster_height': 2028, 'fileformat': 'STLb', 'temp_file': None, 'no_bottom': False, 'bottom_image': None, 'ntilesy': 2, 'only': None, 'no_normals': True, 'geo_transform': (498173.0736371183, 11.23859213655601, 0.0, 5197073.400299733, 0.0, -11.23859213655601), 'use_geo_coords': None, 'smooth_borders': True, 'file_size': 129.38793563842773}, <memory at 0x7f8a7860aa00>)]'. Reason: 'TypeError("cannot pickle 'memoryview' object")'
processing tile: 4 2
top min/max: 2.0 19.96632222357226
... multi-core processing done, logging resumed

4 x 2 tiles, tile size 60.00 x 90.99 mm


UnboundLocalError Traceback (most recent call last)
/var/folders/5k/99c1_1ks5mg432mzv8m22ds40000gn/T/ipykernel_30812/758848299.py in
----> 1 totalsize, full_zip_file_name = TouchTerrain.get_zipped_tiles(**args) # args are in a dict
2 print("\nDONE!\n\nCreated zip file", full_zip_file_name, "%.2f" % totalsize, "Mb")

/Users/Genesis/Downloads/TouchTerrain_for_CAGEO-master-2/touchterrain/common/TouchTerrainEarthEngine.py in get_zipped_tiles(DEM_name, trlat, trlon, bllat, bllon, polygon, polyURL, poly_file, importedDEM, printres, ntilesx, ntilesy, tilewidth, basethick, zscale, fileformat, tile_centered, CPU_cores_to_use, max_cells_for_memory_only, temp_folder, zip_file_name, no_bottom, bottom_image, ignore_leq, lower_leq, unprojected, only, original_query_string, no_normals, projection, use_geo_coords, importedGPX, gpxPathHeight, gpxPixelsBetweenPoints, gpxPathThickness, map_img_filename, smooth_borders, offset_masks_lower, fill_holes, **otherargs)
1402 # concat all processed tiles into a zip file
1403 #print "start of putting tiles into zip file")
-> 1404 for p in processed_list:
1405 tile_info = p[0] # per-tile info
1406 tn = DEM_title+"tile%d_%d" % (tile_info["tile_no_x"],tile_info["tile_no_y"]) + "." + fileformat[:3] # name of file inside zip

UnboundLocalError: local variable 'processed_list' referenced before assignment

Local Python Version: I receive the same error above under the same condition, the only difference being I ran the commands directly through python.

@ChHarding
Copy link
Owner

ChHarding commented Oct 26, 2021 via email

@anciltech
Copy link
Author

Just tried it with both 1 and 2 cores...
1 core works as expected, multiple tiles are created
2 cores causes the same issue as explained in my previous comment

It sounds like maybe the variable processed_list is cleared during/after multiprocessing?

@ChHarding
Copy link
Owner

ChHarding commented Oct 26, 2021 via email

@anciltech
Copy link
Author

Optimal would be a single tile that could be processed on multiple cores, as multiple tiles was more of a work around to begin with, both for performance and size constraints. But now that a single core can put together a large file, I can certainly utilize this to create the monster files I was hoping for. Only gains to be had are on performance, if the multicore functionality is able to be implemented in this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants