-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Feature/0712 model base class #713
Changes from 21 commits
523c11f
0e7723b
162ef7b
2590273
e9f3f43
fc9ef34
de431f8
bc7ee52
cde80e7
1af3eee
845ec86
9c66a19
de37126
60521aa
79b133c
81de06f
6d0dd9f
51f39b8
0f6b9d5
7e3b9d3
81f659c
506b25c
7e316f0
323c2f0
fde50d2
c56eb1f
d403f0c
b22052b
865116e
c4efe06
1bede8a
9404d6f
4e42237
e0d08d5
0e76075
18f23f4
2157e92
655e93f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
# Models (to be passed through stanc) | ||
## | ||
CMDSTAN_MAIN ?= src/cmdstan/main.cpp | ||
CMDSTAN_MAIN_O ?= src/cmdstan/main.o | ||
|
||
STAN_TARGETS = $(patsubst %.stan,%$(EXE),$(wildcard $(patsubst %$(EXE),%.stan,$(MAKECMDGOALS)))) | ||
|
||
|
@@ -23,22 +24,26 @@ ifneq ($(findstring allow_undefined,$(STANCFLAGS)),) | |
$(STAN_TARGETS) examples/bernoulli/bernoulli$(EXE) $(patsubst %.stan,%$(EXE),$(wildcard src/test/test-models/*.stan)) : CXXFLAGS_PROGRAM += -include $(USER_HEADER) | ||
endif | ||
|
||
|
||
%.hpp : %.stan bin/stanc$(EXE) | ||
@echo '' | ||
@echo '--- Translating Stan model to C++ code ---' | ||
$(WINE) bin/stanc$(EXE) $(STANCFLAGS) --o=$@ $< | ||
|
||
%.d: %.hpp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This definition here overrides the one included in the top makefile which pulls in math/make/dependencies. Could you please document that you do this here on purpose. The alternative is to not include the dependencies from math which we may not need actually for cmdstan? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removing the override. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok...once you do that, then the model_header.o dependency can be build. The only downside is that then you will build the dependency thing for the stan model hpp file... which wastes 1s of compile time as it anyway gets recreated with any model update...but ok; still a win. |
||
|
||
.PRECIOUS: %.hpp | ||
%$(EXE) : %.hpp $(CMDSTAN_MAIN) $(LIBSUNDIALS) $(MPI_TARGETS) | ||
%$(EXE) : %.hpp $(CMDSTAN_MAIN_O) $(LIBSUNDIALS) $(MPI_TARGETS) | ||
@echo '' | ||
@echo '--- Linking C++ model ---' | ||
$(LINK.cpp) $(CXXFLAGS_PROGRAM) -include $< $(CMDSTAN_MAIN) $(LDLIBS) $(LIBSUNDIALS) $(MPI_TARGETS) $(OUTPUT_OPTION) | ||
@echo '--- Compiling, linking C++ code ---' | ||
cp $*.hpp $*.cpp; \ | ||
$(LINK.cpp) $(CXXFLAGS_PROGRAM) -c -o $*.o $*.cpp ; \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh.. this is less ideal, I think. You can make the compiler interpret the hpp file just like a c++ file with the
This way you pickup the right things for compilation (first line) and for linking (second line). Moreover, you do not need to do this copying and removing business. |
||
$(CXX) -include $(LDLIBS) $(LIBSUNDIALS) $(MPI_TARGETS) -o $@ $(CMDSTAN_MAIN_O) $*.o; \ | ||
rm $*.cpp $*.o | ||
|
||
|
||
|
||
## | ||
# Dependencies file | ||
# Dependencies file for precompiled header | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this comment is right - these are dependency files for everything. Line 53 includes the one from the model_header file. |
||
## | ||
ifneq (,$(STAN_TARGETS)) | ||
$(patsubst %$(EXE),%.d,$(STAN_TARGETS)) : DEPTARGETS += -MT $(patsubst %.d,%$(EXE),$@) -include $< -include $(CMDSTAN_MAIN) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,7 +151,7 @@ build-mpi: $(MPI_TARGETS) | |
@echo '--- boost mpi bindings built ---' | ||
|
||
.PHONY: build | ||
build: bin/stanc$(EXE) bin/stansummary$(EXE) bin/print$(EXE) bin/diagnose$(EXE) $(LIBSUNDIALS) $(MPI_TARGETS) | ||
build: bin/stanc$(EXE) bin/stansummary$(EXE) bin/print$(EXE) bin/diagnose$(EXE) $(LIBSUNDIALS) $(MPI_TARGETS) $(CMDSTAN_MAIN_O) $(STAN)src/stan/model/model_header.d | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this can stay now once you remove the %.d override, but please verify. |
||
@echo '' | ||
@echo '--- CmdStan v$(CMDSTAN_VERSION) built ---' | ||
|
||
|
@@ -182,6 +182,7 @@ clean-manual: | |
|
||
clean-all: clean clean-deps clean-libraries clean-manual | ||
$(RM) -r bin | ||
$(RM) -r src/cmdstan/main.o | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You want to delete There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be adjusted? |
||
$(RM) $(wildcard $(STAN)src/stan/model/model_header.hpp.gch) | ||
|
||
## | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the patsubst command to derive from CMDSTAN_MAIN the value for CMDSTAN_MAIN_O.