From 5a54ab97f4c241b627347ff4762bba422e3855ff Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 21 May 2021 14:21:54 -0400 Subject: [PATCH 1/9] Disable AdvancedVectorExtensions2 --- PoissonRecon.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PoissonRecon.vcxproj b/PoissonRecon.vcxproj index 7e914953..c340c220 100644 --- a/PoissonRecon.vcxproj +++ b/PoissonRecon.vcxproj @@ -164,7 +164,7 @@ Precise true false - AdvancedVectorExtensions2 + StreamingSIMDExtensions2 From 4b37753829ec24f14829b0a08f17b870233dbb5e Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 21 Jun 2021 17:54:26 +0000 Subject: [PATCH 2/9] use --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 6bd2a3be..14df8194 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,8 @@ LFLAGS_DEBUG = #CFLAGS_RELEASE = -O3 -DRELEASE -funroll-loops -ffast-math -g #LFLAGS_RELEASE = -O3 -g -CFLAGS_RELEASE = -O3 -DRELEASE -funroll-loops -ffast-math -g -LFLAGS_RELEASE = -O3 -g +CFLAGS_RELEASE = -O3 -DRELEASE -funroll-loops -ffast-math -g0 +LFLAGS_RELEASE = -O3 -g0 SRC = Src/ BIN = Bin/Linux/ @@ -143,22 +143,22 @@ clean: rm -rf $(IS_OBJECTS) rm -rf $(AV_OBJECTS) rm -rf $(CP_OBJECTS) - cd PNG && make clean + cd PNG && $(MAKE) clean make_dir: $(MD) -p $(BIN) $(BIN)$(PR_TARGET): $(PR_OBJECTS) - cd PNG && make COMPILER=$(COMPILER) + cd PNG && $(MAKE) COMPILER=$(COMPILER) $(CXX) -pthread -o $@ $(PR_OBJECTS) -L$(BIN) $(LFLAGS) -ljpeg -lmypng -lz $(BIN)$(SR_TARGET): $(SR_OBJECTS) - cd PNG && make COMPILER=$(COMPILER) + cd PNG && $(MAKE) COMPILER=$(COMPILER) $(CXX) -pthread -o $@ $(SR_OBJECTS) -L$(BIN) $(LFLAGS) -ljpeg -lmypng -lz $(BIN)$(PI_TARGET): $(PI_OBJECTS) - cd PNG && make COMPILER=$(COMPILER) + cd PNG && $(MAKE) COMPILER=$(COMPILER) $(CXX) -pthread -o $@ $(PI_OBJECTS) -L$(BIN) $(LFLAGS) -ljpeg -lmypng -lz $(BIN)$(ST_TARGET): $(ST_OBJECTS) @@ -168,15 +168,15 @@ $(BIN)$(EH_TARGET): $(EH_OBJECTS) $(CXX) -pthread -o $@ $(EH_OBJECTS) $(LFLAGS) $(BIN)$(IS_TARGET): $(IS_OBJECTS) - cd PNG && make COMPILER=$(COMPILER) + cd PNG && $(MAKE) COMPILER=$(COMPILER) $(CXX) -pthread -o $@ $(IS_OBJECTS) -L$(BIN) $(LFLAGS) -ljpeg -lmypng -lz $(BIN)$(AV_TARGET): $(AV_OBJECTS) - cd PNG && make COMPILER=$(COMPILER) + cd PNG && $(MAKE) COMPILER=$(COMPILER) $(CXX) -pthread -o $@ $(AV_OBJECTS) -L$(BIN) $(LFLAGS) -ljpeg -lmypng -lz $(BIN)$(CP_TARGET): $(CP_OBJECTS) - cd PNG && make COMPILER=$(COMPILER) + cd PNG && $(MAKE) COMPILER=$(COMPILER) $(CXX) -pthread -o $@ $(CP_OBJECTS) -L$(BIN) $(LFLAGS) -ljpeg -lmypng -lz $(BIN)%.o: $(SRC)%.c From 4b6e70356a23e186b09ec22ec4d2b62e7920d858 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 21 Jun 2021 14:59:51 -0400 Subject: [PATCH 3/9] Visual Studio fixes --- PoissonRecon.vcxproj | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/PoissonRecon.vcxproj b/PoissonRecon.vcxproj index 63ec4b41..0f1fc889 100644 --- a/PoissonRecon.vcxproj +++ b/PoissonRecon.vcxproj @@ -83,7 +83,7 @@ Disabled - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + NOMINMAX;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -107,7 +107,7 @@ Disabled - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + NOMINMAX;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -127,14 +127,14 @@ - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + NOMINMAX;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL Level3 ProgramDatabase true - %(AdditionalIncludeDirectories) + .;%(AdditionalIncludeDirectories) true @@ -188,6 +188,11 @@ + + + + + From 3c9227d4f66f5b07d5db1343d9d6806250dff23b Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Wed, 25 Aug 2021 03:21:02 +0000 Subject: [PATCH 4/9] Fix race condition on arm --- Src/FEMTree.IsoSurface.specialized.inl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Src/FEMTree.IsoSurface.specialized.inl b/Src/FEMTree.IsoSurface.specialized.inl index 9743c5dd..3a8941d3 100644 --- a/Src/FEMTree.IsoSurface.specialized.inl +++ b/Src/FEMTree.IsoSurface.specialized.inl @@ -846,6 +846,8 @@ protected: { typename HyperCube::Cube< Dim >::template Element< 0 > c( zDir , _c.index ); node_index_type vIndex = cIndices[_c.index]; + + #pragma omp critical if( !sValues.cornerSet[vIndex] ) { if( sValues.cornerGradients ) From b5bb1bfbb5c4c6a7a605efdf9fcaa02840bd11e4 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Thu, 2 Sep 2021 19:40:29 +0000 Subject: [PATCH 5/9] Disable parallelization loop on arm64 --- Src/FEMTree.IsoSurface.specialized.inl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Src/FEMTree.IsoSurface.specialized.inl b/Src/FEMTree.IsoSurface.specialized.inl index 3a8941d3..b57960e1 100644 --- a/Src/FEMTree.IsoSurface.specialized.inl +++ b/Src/FEMTree.IsoSurface.specialized.inl @@ -826,8 +826,16 @@ protected: std::vector< ConstCornerSupportKey< UIntPack< FEMSignature< FEMSigs >::Degree ... > > > bNeighborKeys( ThreadPool::NumThreads() ); if( useBoundaryEvaluation ) for( size_t i=0 ; i::template ElementNum< 0 >() ]; @@ -846,8 +854,6 @@ protected: { typename HyperCube::Cube< Dim >::template Element< 0 > c( zDir , _c.index ); node_index_type vIndex = cIndices[_c.index]; - - #pragma omp critical if( !sValues.cornerSet[vIndex] ) { if( sValues.cornerGradients ) @@ -883,7 +889,9 @@ protected: } } } + #ifndef __aarch64__ ); + #endif } ///////////////// // _VertexData // From 77806b0272d23fbe947c222baf8cf8a7b1a31768 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 8 Feb 2022 11:58:12 -0500 Subject: [PATCH 6/9] Remove unroll loops --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 14df8194..f1f3441d 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ LFLAGS_DEBUG = #CFLAGS_RELEASE = -O3 -DRELEASE -funroll-loops -ffast-math -g #LFLAGS_RELEASE = -O3 -g -CFLAGS_RELEASE = -O3 -DRELEASE -funroll-loops -ffast-math -g0 +CFLAGS_RELEASE = -O3 -DRELEASE -ffast-math -g0 LFLAGS_RELEASE = -O3 -g0 SRC = Src/ From 0990c24b0eaf1578096da4e8ad9f959b633f2705 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Wed, 10 Aug 2022 13:14:44 -0400 Subject: [PATCH 7/9] Add macos makefile --- Makefile.macos | 187 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 Makefile.macos diff --git a/Makefile.macos b/Makefile.macos new file mode 100644 index 00000000..365bb3f2 --- /dev/null +++ b/Makefile.macos @@ -0,0 +1,187 @@ +PR_TARGET=PoissonRecon +SR_TARGET=SSDRecon +PI_TARGET=PointInterpolant +ST_TARGET=SurfaceTrimmer +EH_TARGET=EDTInHeat +IS_TARGET=ImageStitching +AV_TARGET=AdaptiveTreeVisualization +CP_TARGET=ChunkPLY +PR_SOURCE=PoissonRecon.cpp +SR_SOURCE=SSDRecon.cpp +PI_SOURCE=PointInterpolant.cpp +ST_SOURCE=SurfaceTrimmer.cpp +EH_SOURCE=EDTInHeat.cpp +IS_SOURCE=ImageStitching.cpp +AV_SOURCE=AdaptiveTreeVisualization.cpp +CP_SOURCE=ChunkPLY.cpp + +COMPILER ?= gcc +#COMPILER ?= clang + +# ifeq ($(COMPILER),gcc) + CFLAGS += -fopenmp -Wno-deprecated -std=c++14 -pthread -Wno-invalid-offsetof + LFLAGS += -lgomp -lstdc++ -lpthread +# else +# # CFLAGS += -fopenmp=libiomp5 -Wno-deprecated -Wno-write-strings -std=c++14 -Wno-invalid-offsetof +# # LFLAGS += -liomp5 -lstdc++ +# CFLAGS += -Wno-deprecated -std=c++14 -pthread -Wno-invalid-offsetof -Wno-dangling-else +# LFLAGS += -lstdc++ +# endif +#LFLAGS += -lz -lpng -ljpeg + +CFLAGS_DEBUG = -DDEBUG -g3 +LFLAGS_DEBUG = + +#CFLAGS_RELEASE = -O3 -DRELEASE -funroll-loops -ffast-math -g +#LFLAGS_RELEASE = -O3 -g +CFLAGS_RELEASE = -O3 -DRELEASE -ffast-math -g0 +LFLAGS_RELEASE = -O3 -g0 + +SRC = Src/ +BIN = Bin/Linux/ +#INCLUDE = /usr/include/ +INCLUDE = . + +ifeq ($(COMPILER),gcc) + CC=gcc + CXX=g++ +else + CC=clang + CXX=clang++ +endif + +MD=mkdir + +PR_OBJECTS=$(addprefix $(BIN), $(addsuffix .o, $(basename $(PR_SOURCE)))) +SR_OBJECTS=$(addprefix $(BIN), $(addsuffix .o, $(basename $(SR_SOURCE)))) +PI_OBJECTS=$(addprefix $(BIN), $(addsuffix .o, $(basename $(PI_SOURCE)))) +ST_OBJECTS=$(addprefix $(BIN), $(addsuffix .o, $(basename $(ST_SOURCE)))) +EH_OBJECTS=$(addprefix $(BIN), $(addsuffix .o, $(basename $(EH_SOURCE)))) +IS_OBJECTS=$(addprefix $(BIN), $(addsuffix .o, $(basename $(IS_SOURCE)))) +AV_OBJECTS=$(addprefix $(BIN), $(addsuffix .o, $(basename $(AV_SOURCE)))) +CP_OBJECTS=$(addprefix $(BIN), $(addsuffix .o, $(basename $(CP_SOURCE)))) + + +all: CFLAGS += $(CFLAGS_RELEASE) +all: LFLAGS += $(LFLAGS_RELEASE) +all: make_dir +all: $(BIN)$(PR_TARGET) +all: $(BIN)$(SR_TARGET) +all: $(BIN)$(PI_TARGET) +all: $(BIN)$(ST_TARGET) +all: $(BIN)$(EH_TARGET) +all: $(BIN)$(IS_TARGET) +all: $(BIN)$(AV_TARGET) +all: $(BIN)$(CP_TARGET) + +debug: CFLAGS += $(CFLAGS_DEBUG) +debug: LFLAGS += $(LFLAGS_DEBUG) +debug: make_dir +debug: $(BIN)$(PR_TARGET) +debug: $(BIN)$(SR_TARGET) +debug: $(BIN)$(PI_TARGET) +debug: $(BIN)$(ST_TARGET) +debug: $(BIN)$(EH_TARGET) +debug: $(BIN)$(IS_TARGET) +debug: $(BIN)$(AV_TARGET) +debug: $(BIN)$(CP_TARGET) + +poissonrecon: CFLAGS += $(CFLAGS_RELEASE) +poissonrecon: LFLAGS += $(LFLAGS_RELEASE) +poissonrecon: make_dir +poissonrecon: $(BIN)$(PR_TARGET) + +ssdrecon: CFLAGS += $(CFLAGS_RELEASE) +ssdrecon: LFLAGS += $(LFLAGS_RELEASE) +ssdrecon: make_dir +ssdrecon: $(BIN)$(SR_TARGET) + +pointinterpolant: CFLAGS += $(CFLAGS_RELEASE) +pointinterpolant: LFLAGS += $(LFLAGS_RELEASE) +pointinterpolant: make_dir +pointinterpolant: $(BIN)$(PI_TARGET) + +surfacetrimmer: CFLAGS += $(CFLAGS_RELEASE) +surfacetrimmer: LFLAGS += $(LFLAGS_RELEASE) +surfacetrimmer: make_dir +surfacetrimmer: $(BIN)$(ST_TARGET) + +edtinheat: CFLAGS += $(CFLAGS_RELEASE) +edtinheat: LFLAGS += $(LFLAGS_RELEASE) +edtinheat: make_dir +edtinheat: $(BIN)$(EH_TARGET) + +imagestitching: CFLAGS += $(CFLAGS_RELEASE) +imagestitching: LFLAGS += $(LFLAGS_RELEASE) +imagestitching: make_dir +imagestitching: $(BIN)$(IS_TARGET) + +octreevisualization: CFLAGS += $(CFLAGS_RELEASE) +octreevisualization: LFLAGS += $(LFLAGS_RELEASE) +octreevisualization: make_dir +octreevisualization: $(BIN)$(AV_TARGET) + +chunkply: CFLAGS += $(CFLAGS_RELEASE) +chunkply: LFLAGS += $(LFLAGS_RELEASE) +chunkply: make_dir +chunkply: $(BIN)$(CP_TARGET) + +clean: + rm -rf $(BIN)$(PR_TARGET) + rm -rf $(BIN)$(SR_TARGET) + rm -rf $(BIN)$(PI_TARGET) + rm -rf $(BIN)$(ST_TARGET) + rm -rf $(BIN)$(EH_TARGET) + rm -rf $(BIN)$(IS_TARGET) + rm -rf $(BIN)$(AV_TARGET) + rm -rf $(BIN)$(CP_TARGET) + rm -rf $(PR_OBJECTS) + rm -rf $(SR_OBJECTS) + rm -rf $(PI_OBJECTS) + rm -rf $(ST_OBJECTS) + rm -rf $(EH_OBJECTS) + rm -rf $(IS_OBJECTS) + rm -rf $(AV_OBJECTS) + rm -rf $(CP_OBJECTS) + cd PNG && $(MAKE) clean + + +make_dir: + $(MD) -p $(BIN) + +$(BIN)$(PR_TARGET): $(PR_OBJECTS) + cd PNG && $(MAKE) COMPILER=$(COMPILER) + $(CXX) -pthread -o $@ $(PR_OBJECTS) -L$(BIN) $(LFLAGS) -ljpeg -lmypng -lz + +$(BIN)$(SR_TARGET): $(SR_OBJECTS) + cd PNG && $(MAKE) COMPILER=$(COMPILER) + $(CXX) -pthread -o $@ $(SR_OBJECTS) -L$(BIN) $(LFLAGS) -ljpeg -lmypng -lz + +$(BIN)$(PI_TARGET): $(PI_OBJECTS) + cd PNG && $(MAKE) COMPILER=$(COMPILER) + $(CXX) -pthread -o $@ $(PI_OBJECTS) -L$(BIN) $(LFLAGS) -ljpeg -lmypng -lz + +$(BIN)$(ST_TARGET): $(ST_OBJECTS) + $(CXX) -pthread -o $@ $(ST_OBJECTS) $(LFLAGS) + +$(BIN)$(EH_TARGET): $(EH_OBJECTS) + $(CXX) -pthread -o $@ $(EH_OBJECTS) $(LFLAGS) + +$(BIN)$(IS_TARGET): $(IS_OBJECTS) + cd PNG && $(MAKE) COMPILER=$(COMPILER) + $(CXX) -pthread -o $@ $(IS_OBJECTS) -L$(BIN) $(LFLAGS) -ljpeg -lmypng -lz + +$(BIN)$(AV_TARGET): $(AV_OBJECTS) + cd PNG && $(MAKE) COMPILER=$(COMPILER) + $(CXX) -pthread -o $@ $(AV_OBJECTS) -L$(BIN) $(LFLAGS) -ljpeg -lmypng -lz + +$(BIN)$(CP_TARGET): $(CP_OBJECTS) + cd PNG && $(MAKE) COMPILER=$(COMPILER) + $(CXX) -pthread -o $@ $(CP_OBJECTS) -L$(BIN) $(LFLAGS) -ljpeg -lmypng -lz + +$(BIN)%.o: $(SRC)%.c + $(CC) -c -o $@ -I$(INCLUDE) $< + +$(BIN)%.o: $(SRC)%.cpp + $(CXX) -c -o $@ $(CFLAGS) -I$(INCLUDE) $< + From 2dfb80fb5d8860771f9fdf64bb9ea603586a6b55 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Wed, 10 Aug 2022 13:31:11 -0400 Subject: [PATCH 8/9] Update Makefile.macos --- Makefile.macos | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/Makefile.macos b/Makefile.macos index 365bb3f2..d791a5e7 100644 --- a/Makefile.macos +++ b/Makefile.macos @@ -16,18 +16,8 @@ AV_SOURCE=AdaptiveTreeVisualization.cpp CP_SOURCE=ChunkPLY.cpp COMPILER ?= gcc -#COMPILER ?= clang - -# ifeq ($(COMPILER),gcc) - CFLAGS += -fopenmp -Wno-deprecated -std=c++14 -pthread -Wno-invalid-offsetof - LFLAGS += -lgomp -lstdc++ -lpthread -# else -# # CFLAGS += -fopenmp=libiomp5 -Wno-deprecated -Wno-write-strings -std=c++14 -Wno-invalid-offsetof -# # LFLAGS += -liomp5 -lstdc++ -# CFLAGS += -Wno-deprecated -std=c++14 -pthread -Wno-invalid-offsetof -Wno-dangling-else -# LFLAGS += -lstdc++ -# endif -#LFLAGS += -lz -lpng -ljpeg +CFLAGS += -fopenmp -Wno-deprecated -std=c++14 -pthread -Wno-invalid-offsetof +LFLAGS += -lgomp -lstdc++ -lpthread CFLAGS_DEBUG = -DDEBUG -g3 LFLAGS_DEBUG = @@ -40,15 +30,11 @@ LFLAGS_RELEASE = -O3 -g0 SRC = Src/ BIN = Bin/Linux/ #INCLUDE = /usr/include/ -INCLUDE = . - -ifeq ($(COMPILER),gcc) - CC=gcc - CXX=g++ -else - CC=clang - CXX=clang++ -endif +INCLUDE = . -I PNG -I JPEG + +CC=gcc +CXX=$(COMPILER) + MD=mkdir From 97caa6d34d1b05b59888bed019dea89ced74445e Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Wed, 10 Aug 2022 14:23:35 -0400 Subject: [PATCH 9/9] Compiles on Mac --- Makefile.macos | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.macos b/Makefile.macos index d791a5e7..e99ca4a9 100644 --- a/Makefile.macos +++ b/Makefile.macos @@ -17,7 +17,7 @@ CP_SOURCE=ChunkPLY.cpp COMPILER ?= gcc CFLAGS += -fopenmp -Wno-deprecated -std=c++14 -pthread -Wno-invalid-offsetof -LFLAGS += -lgomp -lstdc++ -lpthread +LFLAGS += -lgomp -lstdc++ -lpthread -L/opt/homebrew/lib CFLAGS_DEBUG = -DDEBUG -g3 LFLAGS_DEBUG = @@ -30,7 +30,7 @@ LFLAGS_RELEASE = -O3 -g0 SRC = Src/ BIN = Bin/Linux/ #INCLUDE = /usr/include/ -INCLUDE = . -I PNG -I JPEG +INCLUDE = . -I/opt/homebrew/include CC=gcc CXX=$(COMPILER)