{"action":"created","issue":{"url":"https://api.github.com/repos/tbeu/fmi-standard/issues/127","repository_url":"https://api.github.com/repos/tbeu/fmi-standard","labels_url":"https://api.github.com/repos/tbeu/fmi-standard/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/tbeu/fmi-standard/issues/127/comments","events_url":"https://api.github.com/repos/tbeu/fmi-standard/issues/127/events","html_url":"https://github.com/tbeu/fmi-standard/issues/127","id":358244158,"node_id":"MDU6SXNzdWUzNTgyNDQxNTg=","number":127,"title":"Define thread safety","user":{"login":"modelica-trac-importer","id":22202507,"node_id":"MDQ6VXNlcjIyMjAyNTA3","avatar_url":"https://avatars1.githubusercontent.com/u/22202507?v=4","gravatar_id":"","url":"https://api.github.com/users/modelica-trac-importer","html_url":"https://github.com/modelica-trac-importer","followers_url":"https://api.github.com/users/modelica-trac-importer/followers","following_url":"https://api.github.com/users/modelica-trac-importer/following{/other_user}","gists_url":"https://api.github.com/users/modelica-trac-importer/gists{/gist_id}","starred_url":"https://api.github.com/users/modelica-trac-importer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/modelica-trac-importer/subscriptions","organizations_url":"https://api.github.com/users/modelica-trac-importer/orgs","repos_url":"https://api.github.com/users/modelica-trac-importer/repos","events_url":"https://api.github.com/users/modelica-trac-importer/events{/privacy}","received_events_url":"https://api.github.com/users/modelica-trac-importer/received_events","type":"User","site_admin":false},"labels":[{"id":1049503706,"node_id":"MDU6TGFiZWwxMDQ5NTAzNzA2","url":"https://api.github.com/repos/tbeu/fmi-standard/labels/P:%20major","name":"P: major","color":"f6f6f6","default":false},{"id":1049451719,"node_id":"MDU6TGFiZWwxMDQ5NDUxNzE5","url":"https://api.github.com/repos/tbeu/fmi-standard/labels/bug","name":"bug","color":"d73a4a","default":true},{"id":1049502830,"node_id":"MDU6TGFiZWwxMDQ5NTAyODMw","url":"https://api.github.com/repos/tbeu/fmi-standard/labels/specification","name":"specification","color":"0000aa","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-09-08T00:00:21Z","updated_at":"2018-09-08T00:01:01Z","closed_at":null,"author_association":"COLLABORATOR","body":"**Reported by mfriedrich on 5 Feb 2013 14:23 UTC**\nRunning simulation models in parallel is a even more and more upcoming task not only for co-simulation but also for, at least, partial parallelization of right hand side calls. Hence the FMI standard should allow to call at least some FMI functions in parallel.\n\nConsidering a importing tool which includes the following FMUs:\n* A.fmu includes A.dll with functions A_fmiXXX(...)\n* B.fmu includes B.dll with functions B_fmiXXX(...)\n(the prefix A_, B_ for function names does no exist in FMI 2.0 for shared libraries but are used here to simplify things)\n\nAccording the FMI standard string outputs are passed back as simple pointers by functions and the lifetime of such pointers is only up to the next call to any of the FMI interface functions.\n=> Calling two functions with string outputs simultaneously (by threads) is not allowed! (Even not if the functions are from different FMUs since A.fmu and B.fmu may be exported from the same tool ToolA and hence may both link to the common library ToolA.dll of ToolA which may not be thread safe and/or may use the same buffer for string return values.\n\nThis hard limitation is not very critical since calling FMI functions in parallel is only practical for functions with a high computational effort and none of the FMI functions which return a string value are so.\n\nHowever is should be possible, and explicitly stated in the standard, that some FMI functions are allowed to be called in parallel from multiply threads. Only functions with a high computational effort should be listed. If all functions are listed, it forces FMUs to implement a locking mechanism for not thread safe functions to prevent concurrent access. This will decrease the performance of function with nearly no computational effort. This can be avoided if such functions must not be thread safe and are hence not allowed be called in parallel by the importing tool.\n\n\nHence I propose the following functions to be defined thread safe in the standard (TO BE DISCUSSED):\n\nfmiGetReal, fmiGetInteger, fmiGetBoolean\nfmiGetFMUstate, fmiSetFMUstate, fmiFreeFMUstate, FMISerializeFMUstate, fmiDeSerializeFMUstate\nfmiGetPartialDerivatives, fmiGetDirectionalDerivatives\nfmiEventUpdate\nfmiGetDerivatives\nfmiGetEventIndicators\nfmiDoStep\n(Note: calling fmiDoStep in parallel is already allowed by FMI 1.0. But adding it here will unify fmiDoStep with the other functions listed here and the flag canRunAsynchronuously as well as all depending functionality, like the stepFinished callback function, will disappear)\n\nAnd maybe include a capability flag if a FMU does not guaranty thread safety of these functions which may be the case e.g. for FMUs running only on embedded single CPU hardware.\n\n----\n\nMigrated-From: https://trac.fmi-standard.org/ticket/127"},"comment":{"url":"https://api.github.com/repos/tbeu/fmi-standard/issues/comments/419595596","html_url":"https://github.com/tbeu/fmi-standard/issues/127#issuecomment-419595596","issue_url":"https://api.github.com/repos/tbeu/fmi-standard/issues/127","id":419595596,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTU5NTU5Ng==","user":{"login":"modelica-trac-importer","id":22202507,"node_id":"MDQ6VXNlcjIyMjAyNTA3","avatar_url":"https://avatars1.githubusercontent.com/u/22202507?v=4","gravatar_id":"","url":"https://api.github.com/users/modelica-trac-importer","html_url":"https://github.com/modelica-trac-importer","followers_url":"https://api.github.com/users/modelica-trac-importer/followers","following_url":"https://api.github.com/users/modelica-trac-importer/following{/other_user}","gists_url":"https://api.github.com/users/modelica-trac-importer/gists{/gist_id}","starred_url":"https://api.github.com/users/modelica-trac-importer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/modelica-trac-importer/subscriptions","organizations_url":"https://api.github.com/users/modelica-trac-importer/orgs","repos_url":"https://api.github.com/users/modelica-trac-importer/repos","events_url":"https://api.github.com/users/modelica-trac-importer/events{/privacy}","received_events_url":"https://api.github.com/users/modelica-trac-importer/received_events","type":"User","site_admin":false},"created_at":"2018-09-08T00:01:01Z","updated_at":"2018-09-08T00:01:01Z","author_association":"COLLABORATOR","body":"**Comment by torstenblochwitz on 7 Feb 2013 15:32 UTC**\nTorsten: I propose to define that no fmi function can be considered as thread safe for FMI 2.0.\n\nMarkus: OK for 2.0. We should think about it later.\n\nDecision: Add these two points to spec.\n\n"}}
{"actor":{"display_login":"modelica-trac-importer"}}