Skip to content

Commit

Permalink
Remove Obsolete OpenTURNS API implementation (#9618)
Browse files Browse the repository at this point in the history
  - These are obsolete, decade-old attempts to wrap  OpenTURNS calls using its long gone C-xml-wrapper interface.
  • Loading branch information
jschueller committed Oct 31, 2022
1 parent be1f2bf commit 79eca6d
Show file tree
Hide file tree
Showing 21 changed files with 7 additions and 3,716 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Expand Up @@ -197,7 +197,7 @@ install: install-dirs
test ! -d "@OMBUILDDIR@"/share/omnotebook/nls/ || cp -p "@OMBUILDDIR@"/share/omnotebook/nls/*.qm ${INSTALL_SHAREDIR}/omnotebook/nls/
test ! -d "@OMBUILDDIR@"/share/OMSimulator/ || cp -rp "@OMBUILDDIR@"/share/OMSimulator ${INSTALL_SHAREDIR}/
# Scripts
cp -rp "@OMBUILDDIR@"/share/omc/scripts/*.* "@OMBUILDDIR@"/share/omc/scripts/OpenTurns ${INSTALL_SHAREDIR}/omc/scripts
cp -rp "@OMBUILDDIR@"/share/omc/scripts/*.* ${INSTALL_SHAREDIR}/omc/scripts
# Java
cp -p "@OMBUILDDIR@"/share/omc/java/* ${INSTALL_JAVADIR}
# Translations
Expand Down
1 change: 0 additions & 1 deletion OMCompiler/Compiler/.cmake/meta_modelica_source_list.cmake
Expand Up @@ -232,7 +232,6 @@ set(OMC_MM_BACKEND_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/BackEnd/Matching.mo
${CMAKE_CURRENT_SOURCE_DIR}/BackEnd/MathematicaDump.mo
${CMAKE_CURRENT_SOURCE_DIR}/BackEnd/OnRelaxation.mo
${CMAKE_CURRENT_SOURCE_DIR}/BackEnd/OpenTURNS.mo
${CMAKE_CURRENT_SOURCE_DIR}/BackEnd/RemoveSimpleEquations.mo
${CMAKE_CURRENT_SOURCE_DIR}/BackEnd/ResolveLoops.mo
${CMAKE_CURRENT_SOURCE_DIR}/BackEnd/Sorting.mo
Expand Down
746 changes: 0 additions & 746 deletions OMCompiler/Compiler/BackEnd/OpenTURNS.mo

This file was deleted.

14 changes: 0 additions & 14 deletions OMCompiler/Compiler/FrontEnd/ModelicaBuiltin.mo
Expand Up @@ -2068,20 +2068,6 @@ external "builtin";
annotation(preferredView="text");
end instantiateModel;

function buildOpenTURNSInterface "generates wrapper code for OpenTURNS"
input TypeName className;
input String pythonTemplateFile;
input Boolean showFlatModelica = false;
output String outPythonScript;
external "builtin";
end buildOpenTURNSInterface;

function runOpenTURNSPythonScript "runs OpenTURNS with the given python script returning the log file"
input String pythonScriptFile;
output String logOutputFile;
external "builtin";
end runOpenTURNSPythonScript;

function generateCode "The input is a function name for which C-code is generated and compiled into a dll/so"
input TypeName className;
output Boolean success;
Expand Down
14 changes: 0 additions & 14 deletions OMCompiler/Compiler/NFFrontEnd/NFModelicaBuiltin.mo
Expand Up @@ -2321,20 +2321,6 @@ external "builtin";
annotation(preferredView="text");
end instantiateModel;

function buildOpenTURNSInterface "generates wrapper code for OpenTURNS"
input TypeName className;
input String pythonTemplateFile;
input Boolean showFlatModelica = false;
output String outPythonScript;
external "builtin";
end buildOpenTURNSInterface;

function runOpenTURNSPythonScript "runs OpenTURNS with the given python script returning the log file"
input String pythonScriptFile;
output String logOutputFile;
external "builtin";
end runOpenTURNSPythonScript;

function generateCode "The input is a function name for which C-code is generated and compiled into a dll/so"
input TypeName className;
output Boolean success;
Expand Down
91 changes: 0 additions & 91 deletions OMCompiler/Compiler/Script/CevalScriptBackend.mo
Expand Up @@ -110,7 +110,6 @@ import NFSCodeEnv;
import NFSCodeFlatten;
import NFSCodeLookup;
import Obfuscate;
import OpenTURNS;
import PackageManagement;
import Parser;
import Print;
Expand Down Expand Up @@ -1432,30 +1431,6 @@ algorithm
then
ValuesUtil.makeArray(if b then {Values.STRING(executable),Values.STRING(initfilename)} else {Values.STRING(""),Values.STRING("")});
case ("buildOpenTURNSInterface",vals)
equation
(outCache,scriptFile) = buildOpenTURNSInterface(outCache,inEnv,vals,msg);
then
Values.STRING(scriptFile);
case ("buildOpenTURNSInterface",_)
equation
Error.addMessage(Error.INTERNAL_ERROR,{"buildOpenTURNSInterface failed. Use getErrorString() to see why."});
then
fail();
case ("runOpenTURNSPythonScript",vals)
equation
(outCache,logFile) = runOpenTURNSPythonScript(outCache,inEnv,vals,msg);
then
Values.STRING(logFile);
case ("runOpenTURNSPythonScript",_)
equation
Error.addMessage(Error.INTERNAL_ERROR,{"runOpenTURNSPythonScript failed. Use getErrorString() to see why"});
then
fail();
// adrpo: see if the model exists before simulation!
case ("simulate",vals as Values.CODE(Absyn.C_TYPENAME(className))::_)
equation
Expand Down Expand Up @@ -5762,72 +5737,6 @@ algorithm
end matchcontinue;
end createSimulationResultFromcallModelExecutable;

protected function buildOpenTURNSInterface "builds the OpenTURNS interface by calling the OpenTURNS module"
input FCore.Cache inCache;
input FCore.Graph inEnv;
input list<Values.Value> vals;
input Absyn.Msg inMsg;
output FCore.Cache outCache;
output String scriptFile;
algorithm
(outCache,scriptFile):= match(inCache,inEnv,vals,inMsg)
local
String templateFile, str;
Absyn.Program p;
Absyn.Path className;
FCore.Cache cache;
DAE.DAElist dae;
FCore.Graph env;
BackendDAE.BackendDAE dlow;
DAE.FunctionTree funcs;
Boolean showFlatModelica;
String filenameprefix,description;

case(cache,_,{Values.CODE(Absyn.C_TYPENAME(className)),Values.STRING(templateFile),Values.BOOL(showFlatModelica)},_)
equation
(cache,env,SOME(dae),_) = runFrontEnd(cache,inEnv,className,false, transform = true);
//print("instantiated class\n");
funcs = FCore.getFunctionTree(cache);
if showFlatModelica then
print(DAEDump.dumpStr(dae, funcs));
end if;
// get all the variable names with a distribution
// TODO FIXME
// sort all variable names in the distribution order
// TODO FIXME
filenameprefix = AbsynUtil.pathString(className);
description = DAEUtil.daeDescription(dae);
dlow = BackendDAECreate.lower(dae,cache,env,BackendDAE.EXTRA_INFO(description,filenameprefix));
//print("lowered class\n");
//print("calling generateOpenTurnsInterface\n");
scriptFile = OpenTURNS.generateOpenTURNSInterface(dlow, className, SymbolTable.getAbsyn(), templateFile);
then
(cache,scriptFile);

end match;
end buildOpenTURNSInterface;

protected function runOpenTURNSPythonScript
"runs OpenTURNS with the given python script returning the log file"
input FCore.Cache inCache;
input FCore.Graph inEnv;
input list<Values.Value> vals;
input Absyn.Msg inMsg;
output FCore.Cache outCache;
output String outLogFile;
algorithm
(outCache,outLogFile):= match(inCache,inEnv,vals,inMsg)
local
String pythonScriptFile, logFile;
FCore.Cache cache;
case(cache,_,{Values.STRING(pythonScriptFile)},_)
equation
logFile = OpenTURNS.runPythonScript(pythonScriptFile);
then
(cache,logFile);
end match;
end runOpenTURNSPythonScript;

public function getFileDir "author: x02lucpo
returns the dir where class file (.mo) was saved or
$OPENMODELICAHOME/work if the file was not saved yet"
Expand Down
1 change: 0 additions & 1 deletion OMCompiler/Compiler/boot/LoadCompilerSources.mos
Expand Up @@ -267,7 +267,6 @@ if true then /* Suppress output */
"../BackEnd/Matching.mo",
"../BackEnd/MathematicaDump.mo",
"../BackEnd/OnRelaxation.mo",
"../BackEnd/OpenTURNS.mo",
"../BackEnd/RemoveSimpleEquations.mo",
"../BackEnd/ResolveLoops.mo",
"../BackEnd/Sorting.mo",
Expand Down
9 changes: 3 additions & 6 deletions OMCompiler/Makefile.common
Expand Up @@ -46,7 +46,7 @@ $(builddir_inc)/c/fmi1/ \
$(builddir_inc)/c/fmi2/ \
$(builddir_inc)/scripting-API \
$(builddir_java) \
$(builddir_share)/omc/scripts/OpenTurns/ \
$(builddir_share)/omc/scripts/ \
$(builddir_doc)/omc/testmodels \
$(builddir_man)/man1/

Expand All @@ -67,7 +67,7 @@ $(info Creating dirs: $(BUILD_DIRS))
$(info $(shell mkdir -p $(BUILD_DIRS)))
endif

.PHONY : interactive omc release all fmi test install-dirs susan susan_all susgen sustst install-openturns runtimeCPPinstall runtimeCPPinstallOld CMinpack metis Cdaskr boehm-gc libzmq cppzmq libffi $(MINGW_EXTRA_LIBS) antlr-copy $(SEMLA_LIB) $(SEMLA_CLEAN)
.PHONY : interactive omc release all fmi test install-dirs susan susan_all susgen sustst runtimeCPPinstall runtimeCPPinstallOld CMinpack metis Cdaskr boehm-gc libzmq cppzmq libffi $(MINGW_EXTRA_LIBS) antlr-copy $(SEMLA_LIB) $(SEMLA_CLEAN)

ifeq ($(OMENCRYPTION),yes)
semla:
Expand Down Expand Up @@ -105,9 +105,6 @@ antlr-copy:

sim-dependencies: fmi $(BOOTSTRAP_FMIL_DEP) opencl_rt lis metis opc parmodauto

install-openturns:
(cp SimulationRuntime/OpenTurns/* $(builddir_share)/omc/scripts/OpenTurns/)

$(builddir_share)/omc/omc_communication.idl: Compiler/runtime/omc_communication.idl
mkdir -p $(builddir_share)/omc
cp -a "$<" "$@"
Expand Down Expand Up @@ -549,7 +546,7 @@ install: install-dirs
# Shared data
cp -rp ${builddir_share}/omc/*.* ${builddir_share}/omc/runtime ${INSTALL_SHAREDIR}/omc/
# Scripts
cp -rp ${builddir_share}/omc/scripts/*.* ${builddir_share}/omc/scripts/OpenTurns ${INSTALL_SHAREDIR}/omc/scripts
cp -rp ${builddir_share}/omc/scripts/*.* ${INSTALL_SHAREDIR}/omc/scripts
# Java
cp -p /${builddir_java}/* ${INSTALL_JAVADIR}
# Translations
Expand Down
2 changes: 1 addition & 1 deletion OMCompiler/Makefile.in
Expand Up @@ -112,7 +112,7 @@ $(OMBUILDDIR)/$(LIB_OMC)/libomcgc.so: 3rdParty/gc/.libs/libomcgc.so
$(MAKE) -C 3rdParty/gc/ libomcgc.la

omc-bootstrapped: $(SEMLA_LIB)
$(MAKE) interactive sim-dependencies install-openturns
$(MAKE) interactive sim-dependencies
$(MAKE) ModelicaExternalC
$(MAKE) -C Compiler/boot OMBUILDDIR=$(OMBUILDDIR)
$(MAKE) -f $(defaultMakefileTarget) -C Compiler install_scripts OMBUILDDIR=$(OMBUILDDIR)
Expand Down
4 changes: 2 additions & 2 deletions OMCompiler/Makefile.omdev.mingw
Expand Up @@ -117,7 +117,7 @@ SEMLA_LIB=semla
SEMLA_CLEAN=semla-clean
endif

main.PHONY: simulationruntimecmsvc runtimeCPPinstall runtimeCPPmsvcinstall OMSICPPinstall getMSVCversion omdev_extra_dlls install-openturns copycppmsvcheader boehm-gc-lib fmil_msvc sundials_msvc CMinpack_msvc suitesparse_msvc runtimeOMSIBaseMSVCInstall omcCAPImsvcinstall
main.PHONY: simulationruntimecmsvc runtimeCPPinstall runtimeCPPmsvcinstall OMSICPPinstall getMSVCversion omdev_extra_dlls copycppmsvcheader boehm-gc-lib fmil_msvc sundials_msvc CMinpack_msvc suitesparse_msvc runtimeOMSIBaseMSVCInstall omcCAPImsvcinstall

include Makefile.common
include Makefile.omsi.common
Expand Down Expand Up @@ -229,7 +229,7 @@ testlogwindows:
cat testsuite/testsuite-trace.txt | grep "==== Log" | wc -l
cat testsuite/testsuite-trace.txt | grep "==== Log" ; echo DONE!

omdev_extra_dlls: install-openturns
omdev_extra_dlls:
echo Copying needed .dlls to the $(OMBUILDDIR)/bin directory
ifeq (MINGW32,$(findstring MINGW32,$(shell uname)))
# build 32 bit libOpenCL.a
Expand Down
11 changes: 0 additions & 11 deletions OMCompiler/SimulationRuntime/OpenTurns/invoke.cmd

This file was deleted.

0 comments on commit 79eca6d

Please sign in to comment.