[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
What are the best programming languages for modelling with PDEs?
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /sci/ - Science & Math

Thread replies: 39
Thread images: 2
File: 1464424949988.jpg (451 KB, 2100x1500) Image search: [Google]
1464424949988.jpg
451 KB, 2100x1500
What are the best programming languages for modelling with PDEs?

I'm looking for something FAST, doesn't matter if the syntax is a total pain in the ass to learn.
>>
>>8105919
MATLAB is good.
>>
>>8105936
Isn't there something faster?
>>
>>8105941
Faster to learn, faster to code or faster to execute?

If you have some programming experience, MATLAB should only take a few weeks of solid work to get the hang of.
>>
>>8105919
When you say "FAST" do you mean something that is fast to learn/implement/program or something that is computationally fast?

If you want both you'll be shopping for proprietary btw, so that depends on how big your PI's checkbook is.
>>
>>8105919
C++ most likely. It's used in PDEs for financial modelling and in CFD.
>>
>>8105919
fortran.
>>
>>8105941
Fortran + LAPACK
>>
>>8105919
fortran
>>
>>8105919
Python is actually a good thing too
>>
Julia is the only right answer. You can also go for C++ or FORTRAN if you actually want shitty syntax. Ignore people recommending Matlab and Python.
>>
>>8105942
>>8105936
Matlab is the worst language and toolset you could possibly use. DO NOT LISTEN to this anon, unless you are working with folks who already depend on Matlab.

ANY upfront savings in 'ease' or 'simplicity' is completely cashed in and paid back 10 fold as soon as you try to do anything non-trivial.

The matrix being the one-size-fits-all data structure is a huge mistake. Most of the time spent programming Matlab is how to program to take advantage of the matrix behavior. This ends up taking 10x more time, produces code that is barely readable and difficult to reason about, and at the end of the day you still have a slow piece of shit.

The Matlab language at it's core is fucked. The libraries have inconsistent behavior. The weakly typed system leads to hard to track down errors when you accidentally change a type or misspell an identifier. Interfacing with other languages is a nightmare. The execution model is retarded. etc. etc. etc. ET FUCKING CETERA.

Matlab is good for about 10 minutes. If you use it longer than that, you are digging a hole that is going to warp your sense of coding, produce rube-goldberg code that takes forever to run, and in general have a bad time.

Rant over. You want power? C/C++. Not everything will be ready for you at the start, but at least you will have control over your machine.
>>
>>8106444
>You want power? C/C++
Matlab is shit but now you're just trolling.
>>
>>8106451
No, I'm not. I am just willing to invest in overhead costs for faster, more maintainable, more flexible software.
>>
>>8106444
>C++
Why do you keep telling this meme? C is alright, but C++ is absolutely disgusting, my friend.
>>
>>8106495
Truth be told I'm more of a C person myself. C++ is essentially just a set of extensions, so I included it. Granted, a lot of parallel optimization libraries are in C++.
>>
>>8106469
>C/C++
>maintainable and flexible
Fuck off, you've clearly never done anything in the real world. Go back to /g/ and circlejerk over how a 5% speedup is worth 10 times the dev time.
>>
>>8106531
Fuck you. I've been working for 2.5 years on a Matlab project and I know the language and how to use it effectively inside and out. It's the worst part about working in my department, hands down. I'm sick and fucking tired of working with code that is impossible to reason about because it's been vectorize. I'm tired of how incredibly obtuse vectorizing code to make it efficient is, ans you want to talk about 10x the dev time, well fuck you too, because your dead wrong. The amount of effort that has gone into optimizing shit for Matlab and dealing with it's broken ass language constructs, because that's literally the only language any one else speaks where I work, has wasted literally months on man hours.

Fuck Matlab. Fuck it in the ass.
>>
>>8106540
Why didn't you rewrite the whole thing in C if it's so great?
>>
>>8106546
Because I choose to work with my peers as a fellow researcher rather than be a recluse.
>>
>>8106495
C is obsolete.
https://www.youtube.com/watch?v=KlPC3O1DVcg
>>
>>8106540
>I'm sick and fucking tired of working with code that is impossible to reason about because it's been vectorize

Not matlab's fault you are retarded. Vectorized code is far cleaner to read than a bunch of nested loops.
>>
File: 1455794637612.jpg (109 KB, 900x900) Image search: [Google]
1455794637612.jpg
109 KB, 900x900
>>8106495
>>8106531
>>
>>8106655
>c++ creator says c is obsolute
yea, and my lawyer tells me i need a lawyer for every minor infraction. My doctor tells me I should get myself checked for every little pain.
C++ creator, which extends c, says c is obsolute
lawyer says I need a lawyer
doctor says I need a doctor

he's not even claiming it's obsolete though, just that it shouldn't be a language on its own and instead be merged into c++ as a subset.
>>
Java
>>
>>8106495

Unless you're working with ABIs, legacy shit, or an obscure architecture, there is no reason not to use (a subset of) C++ over C.

>But calculators have all these functions I don't need bloating the circuits up and slowing them down. It must take hours to add 2+2 and forever to learn.
>Use slide rulers like we did back in the day. It's down to the bare paper calculating!
>>
>>8106793
http://harmful.cat-v.org/software/c++/linus
>>
>>8106816
Linus and RMS are autistic and can't stand people doing things differently then them.
>>
>>8106816
>His main complaint is that the STL and Boost were not stable.

That is a good complaint but that is the kind of complaint that you only have to make once. This is 2016, not 2007. I've used Boost, I've obviously used the STL, it works just fine. Stop being so paranoid about everything.

He is okay for doing it, he was making a fucking OS. But you and the other people on /g/ that have linked that do not have to worry about that. You make shitty iOS games for little kids.

His other complaint is that you shouldn't use C++ for kernels.

Sure, don't use C++ for kernels. It really makes sense to use only the lowest of the lowest and C++ is definitely not the lowest of the lowest.

But for everything else C++ is superior... and you can just write C in C++. No need to worry about the compilers anymore, 2016.
>>
>>8106444
No. Well, it depends on what op is really after. I use matlab all the time, but not for any large application. Maybe op has an equation he wants to implement to get results for a paper, like a proof of concept. Matlab is great for that. Even if he has a complicated equation and matlab is slow, I'd suggest just writing the important loop in C and calling it from matlab.

Getting anal about programming it "right" can be a real waste of time if you are just going to run it a few times to get the result and move on.
>>
>>8106816
you're a fucking idiot perpetuating a meme complaint which is very specific and applying it to everything

a reasonable subset of C++ instantly avoids all these issues even in the special case in which they arise
>>
>>8106824
RMS is autistic and can't convince anyone who doesn't already agree with him.
linus is always pretty logical with his arguments, he just tends to put people off cause he doesn't present them in a very nice way.
>I've used Boost,
clearly you haven't
>C++ is definitely not the lowest of the lowest.
>Sure, don't use C++ for kernels
but the point these people were making is that c should just be part of c++. If that was true, then it implies c++ is just as low level and that there shouldn't be a drawback to using it for kernels.
>His main complaint is that the STL and Boost were not stable.
>But for everything else C++ is superior... and you can just write C in C++
actually his larger complaint has to do with the paradigms of c++. Writing in a language is more than just writing code that compiles with that language's compiler. For example, if you write a program using structs and c-style i/o you can hardly say it's a c++ program just because it compiles with a c++ compiler. linus' problem is with the paradigms of c++ coders.
>>8106876
>you're a fucking idiot perpetuating a meme complaint which is very specific and applying it to everything
you're a fucking idiot that hasn't the thread if you think that's a valid argument. the original reply was to a post saying c should just be a subset of c++. Stating a field in which this is untrue is hardly "applying it to everything".
>>
>>8106885
woops middle part was to >>8106843
>>
Just do the calculations in you are head
>>
>>8106885
>it implies c++ is just as low level and that there shouldn't be a drawback to using it for kernels

What I'm saying is that you don't need to use STL, Boost or really any of the 'advanced' functionality of C++ if you are doing low level stuff.

C++ is literally the same as C as long as you just use the basics but if you want to risk it and use outside libraries and templates and virtual inheritance and shit then the risk is on you.

That said, it shouldn't be a big risk. Compilers are good, no need to fear them.

>linus' problem is with the paradigms of c++ coders

But this is a bad argument. Who are C++ coders? Anyone.

The thing is C++ gives you tools and you can choose to use them and not to use them as you desire.

As you said, I can do everything in C-style with structs, printf, C-style strings, etc. and it will compile with C++. So do it. However, if your project would benefit from classes, RAII, Templates then also use those, but only if you need them.

Let me tell you something, I have never used templates in my projects. Not even once. I just do not need them but maybe one day I will.

Object oriented programming? It is useful in many kinds of programs and Linus even admits it. You use it as you need it.

Nothing about C++ is inherently bad and good C++ programmers know this.

If your and his complaint is purely about bad programmers then right back at ya, buddy, because at /g/ every single day someone says that C programmers are bastard retards that invite stack overflows every day, every night.

I appreciate C++ because of its freedom. While languages like Java force you to do classes and C forces you to not use classes, C++ stands in the middle and says: You are a responsible grown fucking man, you choose wether or not you want to use classes and after you are done lets go get some drinks at the bar.
>>
>>8106916
>What I'm saying is that you don't need to use
>The thing is C++ gives you tools and you can choose to use them and not to use them as you desire
> It is useful in many kinds of programs and Linus even admits it. You use it as you need it.
he specifically addresses this
>You invariably start using
the "nice" library features of the language like STL and Boost and other
total and utter crap
now that argument isn't universal. In some cases yes, the disadvantages of certain features may not be relevant to the task you are trying to accomplish. for example, performance issues of templates don't matter at all if performance isn't a huge issue to your program in the first place. But when you KNOW that strict c is better suited to your program why wouldn't you just limit your software developer by using a c compiler? If you go the other way and just tell your developers to just use a subset of c++, whats to stop them from doing it other than your word? They have a chance to bring in things that they feel are harmless. Why would you give your developers a chance to fuck up your project? If you want to limit people to what basically amounts to c, then just use c.
>But this is a bad argument. Who are C++ coders? Anyone.
some c++ programmers might make good c programmers as well, but some of them might be terrible at it. now there are terrible c programmers that program in c, but it's much easier to catch them when they write in c than it is to catch a bad c programmer when they write in c++.
>Nothing about C++ is inherently bad and good C++ programmers know this.
>I appreciate C++ because of its freedom
I get the feeling that you think i'm attacking c++, i'm not. But there's no free lunch. the flexibility of c++ has some costs and depending on the application the costs might be too great even if for others it's meaningless. I'm just saying its usefulness depends on the application.
>>
Just wondering but how old is everyone in this thread?
>>
Not sure if PDEs lend themselves to graphics cards. But if they do, they can be 1000 times faster than *any* language on a cpu. Couple different languages, syntax mostly looks like C.

Else. C++11 (and later) is really nice. Been programming more than 20 years. New C++ is like python but compiled and type safe.

Even check out swift. Syntax is easy to learn and compiles with clang to (probably) close to C efficiency.

If you can get your algorithms onto a graphics card, you will be pleasantly surprised.
>>
>>8105942
I have a lot of experience in MATLAB, but some programs take 2 hours to run. Is C++ or something like Haskell better?
Thread replies: 39
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.