从头开始实施科学仿真方法的最佳实践 [英] Best practices when implementing a scientific simulation methodology from scratch

查看:119
本文介绍了从头开始实施科学仿真方法的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在科学模拟(物理学)领域,我正在考虑开发一些使用C/C ++的新模拟程序包.从头开始时,您认为最佳做法是什么?你能推荐一些书目吗?

谢谢

解决方案

这里有一些阅读清单.不知道这对您来说是否太基础了:

工程与科学C ++ :C ++编程的一个不错的,针对特定领域的介绍.在语言细节上有些过时,但是整体方法还没有过时.

我建议您通读SO这类问题的答案,例如我应该如何设计大型C ++程序?"在其他可能感兴趣的书上寻求建议.

关于最佳做法,这里有一些建议.同样,我不确定您的起点,所以其中有些可能太基本了:

  • 如上所述,您应该从一开始就计划开发一个并行程序.如果不是在集群上传递消息,那至少要考虑为多核桌面进行共享内存编程. OpenMP 值得研究.
  • 使自己熟悉现有工作. BOOST 库可能是必不可少的.当我为您打算自己动手而称​​赞时,请不要忽略现有的完善数字库,例如BLAS和LAPACK,您可以在 Netlib .根据您的开发平台和工具集,您可能会发现它们已经安装.
  • 如果您来自科学背景,则可能需要提高对软件工程的了解和技能.诸如以下的事项:源代码控制;测试;代码分析和优化;对您的编译器可以做什么的深入了解.以我的经验,许多计算科学家在所有这些方面的知识都很薄弱.
  • 您应该计划(大约)花费与设计实际代码一样的时间来设计和测试程序.即使您自己工作,也必须在开始编码之前制定良好的行动计划.没有理由为什么它必须在一开始就在每个细节上都是完整的,但从来没有输入地图就不要进入领地.
  • 您对要模拟的物理世界的各个方面保持沉默.各种各样的物理模拟中都有许多现有技术,如果您有更多的具体知识,那么SO也许可以提供一些更具体的建议.

in the field of scientific simulations (physics) I am thinking about developing some new simulation package in C/C++. What do you think would be the best practices when starting here from scratch? Can you recommend some bibliography?

Thanks

解决方案

Here's something of a reading list. Not sure if it's too basic for you:

Writing Scientific Software: a good follow-on to a basic 'Learn to Program in C++' or whatever.

Parallel Scientific Computing in C++ and MPI: if you are not planning to parallelise your application, you should be.

Engineering and Scientific C++: a good, domain-specific, introduction to programming in C++. A bit dated in language details, but the overall approach hasn't aged.

I suggest that you read through the SO answers to questions such as 'How should I design a large C++ program ?' for advice on other books which may be of interest.

As to best practices, here are some suggestions. Again, I'm not sure of your starting point so some of this may be too basic:

  • As I wrote above, you should be planning from the outset to develop a parallel program. If message-passing on a cluster is not your cup of tea, at least consider shared memory programming for a multi-core desktop. OpenMP is worth investigating.
  • Make yourself familiar with existing work. The BOOST libraries are probably essential. While I applaud your intention to roll-your-own, don't ignore existing well-established numerical libraries such as BLAS and LAPACK which you'll find at Netlib. Depending on your development platform and toolset you may find them already installed.
  • If you are coming from a scientific background, you may want to improve your knowledge of and skills in software engineering. Matters such as: source code control; testing; code profiling and optimisation; deep knowledge of what your compiler(s) can do. In my experience many computational scientists have a weak background in all of this stuff.
  • You should be planning to spend (approximately) as much time on designing and testing your program as on actually coding it. Even working on your own it is essential to have a good plan of action before you start coding. There's no reason why it has to be complete in every detail at the beginning but never enter territory without a map.
  • You are silent on the aspect(s) of the physical world you want to simulate. There is a lot of prior art in all sorts of physical simulations, if you were a bit more specific SO might be able to provide some more specific suggestions.

这篇关于从头开始实施科学仿真方法的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆