- Finding CPU utilization of NUMA nodes - 3 Updates
- Propose a project for analysis by PVS-Studio: now on GitHub - 3 Updates
- Why I Dislike Synthetic Tests - 3 Updates
- results are not being written - 5 Updates
- Could this container I made have any use? - 1 Update
- cmsg cancel <PwxmA.207008$yv3.122612@fx30.am4> - 2 Updates
- VENDOR WITH DISCREET SHIPPING AND PACKAGING METHOD. PAINKILLERS AVAILABLE FOR SALE, ALONGSIDE MEDICAL MARIJUANA FOR DEPRESSION,SLIP DISC, CHRONIC PAIN, INSOMNIA ETC. You can get a hold of me through email, text or call: Email: topcaliberstocks@protonmail.com OR Tel = Call/Text: +1(469) 249 2518 - 2 Updates
- C++ 2017 -- win, lose and draw - 2 Updates
- RTL text (e.g. Arabic) input implemented in "neogfx" my C++ OpenGL GUI/game library... - 1 Update
Paavo Helde <myfirstname@osa.pri.ee>: Feb 08 10:44AM +0200 Sorry for off-topic post, but comp.programming.threads seems to be long dead. In short, I need to find out current CPU utilization of different NUMA nodes in the computer. Could you suggest a portable (at least Windows+Linux) C or C++ library for doing this? My google-fu is somehow failing me today... TIA Paavo |
scott@slp53.sl.home (Scott Lurndal): Feb 08 01:22PM >nodes in the computer. Could you suggest a portable (at least >Windows+Linux) C or C++ library for doing this? My google-fu is somehow >failing me today... Not particularly portable, but: On Linux, you can get the cpu utilization by reading /proc/stat. You can determine the numa configuration using libnuma. man 3 numa man 5 proc $ cat /proc/stat cpu 468313627 3965537 187019877 9970190111 2918517 161185 4280251 0 4637258 cpu0 227884368 566411 17349912 1087913613 258729 1448 619035 0 1120146 cpu1 53250242 485882 21573270 1265011780 133365 99 341893 0 3024854 cpu2 41850867 643670 30634919 1254931613 188815 262 725175 0 224627 cpu3 28215097 729617 22785914 1259180937 2203630 601 598373 0 115891 cpu4 34656271 407981 28902824 1268742744 26178 395 590566 0 59265 cpu5 23679534 331028 20223783 1273092087 43387 431 494331 0 25066 cpu6 34225622 389284 25292245 1278171824 19862 157438 514237 0 43466 cpu7 24551623 411659 20257006 1283145510 44548 508 396638 0 23941 intr 19978667854 44748 0 0 2 2 0 0 0 1 0 0 0 0 0 0 0 174 0 0 0 0 0 0 1745712340 0 0 0 0 17853204 11517450 67817 488310827 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ctxt 1633898650406 btime 1473175794 processes 8949363 procs_running 5 procs_blocked 0 softirq 34362581836 0 3495208294 7685981 493519202 24340829 0 4019633 2692771779 2676700522 3493499116 |
Paavo Helde <myfirstname@osa.pri.ee>: Feb 08 10:59PM +0200 On 8.02.2017 15:22, Scott Lurndal wrote: > cpu1 53250242 485882 21573270 1265011780 133365 99 341893 0 3024854 > cpu2 41850867 643670 30634919 1254931613 188815 262 725175 0 224627 > cpu3 28215097 729617 22785914 1259180937 2203630 601 598373 0 115891 So for finding out the current load I need to read /proc/stat, wait a bit, and read it again? There is nothing like /proc/loadavg per CPU? Actually I am not sure any more if there is any point to try to measure the CPU load. I was thinking of using it for binding the instances of my program to different NUMA nodes, but measuring the current performance does not help in any way if N instances of the program are launched at the same time. Thanks Paavo |
Andrey Karpov <karpov2007@gmail.com>: Feb 08 04:35AM -0800 It's not the easiest task to check projects using a static analyzer and to write review articles, describing the bugs found. Almost always it is work of a team, not just one person. The choice of a project plays quite a significant role in it. Because this directly affects the interest of readers for an article about the project check. In this post I want to explain how you can suggest an interesting project for analysis on GitHub: http://www.viva64.com/en/b/0473/ |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Feb 08 09:13AM -0800 On Wednesday, February 8, 2017 at 7:35:39 AM UTC-5, Andrey Karpov wrote: > It's not the easiest task to check projects using a static analyzer and to write review articles, describing the bugs found. Almost always it is work of a team, not just one person. The choice of a project plays quite a significant role in it. Because this directly affects the interest of readers for an article about the project check. In this post I want to explain how you can suggest an interesting project for analysis on GitHub: http://www.viva64.com/en/b/0473/ You're welcome to test my project if you like. I have no doubt it has many bugs as I've been the sole developer on almost all of it. I use a C++ compiler, but do mostly C code. Clone my repository into c:\ (it creates c:\libsf\ directory): https://github.com/RickCHodgin/libsf The project to test is here: https://github.com/RickCHodgin/libsf/tree/master/source/vjr/projects/vs2008 c:\libsf\source\vjr\projects\vs2008\vjr.sln You won't hurt my feelings if you do not test it. It's just an offer to your question. The program is called "Visual FreePro, Jr." and it provides a general forms framework used for several other projects as well. Thank you, Rick C. Hodgin |
legalize+jeeves@mail.xmission.com (Richard): Feb 08 08:16PM [Please do not mail me a copy of your followup] Andrey Karpov <karpov2007@gmail.com> spake the secret code >readers for an article about the project check. In this post I want to >explain how you can suggest an interesting project for analysis on >GitHub: http://www.viva64.com/en/b/0473/ I know it's C and not C++, but have you run PVS on the source of the X Window System? -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Terminals Wiki <http://terminals-wiki.org> The Computer Graphics Museum <http://computergraphicsmuseum.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
Andrey Karpov <karpov2007@gmail.com>: Feb 07 10:52PM -0800 On Monday, 6 February 2017 14:43:35 UTC+3, Öö Tiib wrote: > defect that may crash or crash was really part of requirements? > Are you making psychic software? :-D :-P Whatever it does, I don't > expect it to do that. So for me your program misbehaves, sorry. Everything is based on our experience of checking hundreds of projects: http://www.viva64.com/en/examples/ I suggest having a closer look at the description in the article. The criterion is the presence of AND in the title and strange code. When we say strange code we mean when NULL is assigned IMMEDIATELY and is dereferenced right after it. The statement itself T *x = 0; *x = 0; doesn't look natural. Please, understand that people don't make such mistakes. If the assignment is in different places in the body of the function, then yes, it can be a mistake. And we will find such a case. But you can't go wrong, dereferencing a pointer on the next line. However, the analyzer is ready for such cases as well and just to be sure, we analyze the name of the function too. I can change my mind only in case I see a real example of such an error, where there is an assignment and immediate dereference, although it wasn't meant to be so. And in this case the name of the function is let's say, crash. But there is no such a thing in the universe. |
"Öö Tiib" <ootiib@hot.ee>: Feb 08 08:21AM -0800 On Wednesday, 8 February 2017 08:52:32 UTC+2, Andrey Karpov wrote: > > Are you making psychic software? :-D :-P Whatever it does, I don't > > expect it to do that. So for me your program misbehaves, sorry. > Everything is based on our experience of checking hundreds of projects: http://www.viva64.com/en/examples/ The problem may be that you checked only with works of rehearsal and/or beneficence. > T *x = 0; > *x = 0; > doesn't look natural. I did read the article. Is it self-irony? Repeating same points again and again do not make those any more correct. Q: Does your software have say diagnostic #413 about "accidental- looking null pointer dereference" and #417 about "willful-looking null pointer dereference"? A: No. Q: So why you detect that willful-lookingness? A: To silently filter out. Q: Why? That is bad feature, how to turn it off? A: There's no way. Q: Wtf? A: > Please, understand that people don't make such mistakes. Q: Who told about mistakes? Everybody I know would *love* to find out willful sabotage *even* *sooner* than accidental mistakes. I already wrote that. It is still quoted above. You just are with fixed mindset and so can't read nor can reason about it. <snip rest of the same repeated over and over> |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Feb 08 08:29AM -0800 On Wednesday, February 8, 2017 at 1:52:32 AM UTC-5, Andrey Karpov wrote: > On Monday, 6 February 2017 14:43:35 UTC+3, Öö Tiib wrote: > > Everybody expects you to have biased opinion about your product... > Everything is based on our experience of checking hundreds of projects... Your product may be fantastic. But, you're going about pushing it the wrong way. You come across as combative and hostile toward those things many of us have relied upon for years. If you want to get us to use your product, you'll need to teach us why your way is better. There are some excellent videos with Kostya Serebryany from Google on his use of sanitizers to track down real bugs in code. He explains what his product does, and the types of bugs it finds, along with giving some numbers for how many bugs are found at various companies. 2013: https://www.youtube.com/watch?v=Q2C2lP8_tNE 2014: https://www.youtube.com/watch?v=V2_80g0eOMc 2015: https://www.youtube.com/watch?v=qTkYDA0En6U I haven't found him speaking similarly in 2016 or 2017 yet. If anyone knows additional links, please post them. Thank you, Rick C. Hodgin |
thebtc@hotmail.com: Feb 07 07:59PM -0800 Hi, I'm having problems with the following code: #include <iostream> #include <fstream> #include "params.h" extern void timestep(std::ofstream& fout, double* rho_prev, double* rho, double* rho_next, double* x); int main() { // Open output file std::ofstream fout(outfilename); // Define and allocate arrays double* rho_prev = new double[npnts]; // time step t-1 double* rho = new double[npnts]; // time step double* rho_next = new double[npnts]; // time step t+1 double* x = new double[npnts]; // x values // Initialize for (int i = 0; i < npnts; i++) { x[i] = x1 + ((i-1)*(x2-x1))/ngrid; rho_prev[i] = 0.0; rho[i] = 0.0; rho_next[i] = 0.0; } timestep(fout, &rho_prev[0], &rho[0], &rho_next[0], &x[0]); // Close file fout.close(); std::cout << "Results written to " << outfilename << std::endl; } So in this code, I have the function timestep that is defined in another .cc code. I know there's nothing wrong with this function because other executables that I construct with timestep in them run exactly as expected. Secondly, params.h contains externs for a .cc file called params.cc. params.cc contains a whole bunch of variables and their assignments. It also contains the following that is relevant to the above: std::string outfilename = "result.txt"; // name of the file with the output data I am basically making a list of x values that are sent to result.txt. I am also making time values that should be all 0. This is part of a sanity check I am performing for a large number of modules that I later link using a Makefile. The problem here is that when I run my Makefile, I get the output "Results written to result.txt" however when I look inside result.txt its empty. What is wrong with my code? |
"Fred.Zwarts" <F.Zwarts@KVI.nl>: Feb 08 10:02AM +0100 schreef in bericht news:f0cab520-a84e-49fc-b327-fc0563932aac@googlegroups.com... >a Makefile. The problem here is that when I run my Makefile, I get the >output "Results written to result.txt" however when I look inside >result.txt its empty. What is wrong with my code? 1) Why don't you check the status of fout after opening the file? 2) Do you check the status of fout after output operations? 3) Are you sure that the function timestep does not have undefined behaviour? Undefined behaviour includes expected behaviour, so when it has expected results in other executables, it does not prove that it is correct. 4) The problem is probably in a part of the program that you do not show. Reduce your program until it is small enough to present to this group and still shows your problem. When we can reproduce the problem, then we may be able to help you. Probably, you will find the cause of your problem already yourself in the process. |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Feb 08 10:04AM +0100 > std::cout << "Results written to " << outfilename << std::endl; > } > So in this code, I have the function timestep that is defined in another .cc code. That's probably where the problem you're concerned about, is. > I know there's nothing wrong with this function That's silly. You know that's likely where the problem is. [snip] Cheers!, & do think about earlier advice to post a REPRODUCIBLE example, - Alf |
Juha Nieminen <nospam@thanks.invalid>: Feb 08 09:30AM > double* rho = new double[npnts]; // time step > double* rho_next = new double[npnts]; // time step t+1 > double* x = new double[npnts]; // x values Why do you insist in doing this? If you really need to allocate arrays dynamically, what exactly is wrong with using std::vector for that? There are good reasons why C++ offers dynamic allocation of arrays using the 'new' keyword, but those reasons don't come up in actual practical code very often. In 99% of cases, in practical code, std::vector is the better choice (it does the exact same thing, but more safely because it's a lot harder to leak memory with it). |
thebtc@hotmail.com: Feb 08 08:03AM -0800 Ok well I figured out what the problem is. There's nothing wrong with the timestep function as I suspected, because other modules depend on this timestep function and they also produce textfiles that I have to compare to known values and I'm getting the correct results. The problem is, my params.h is not being read. Because when I manually enter the parameters in the above code, the problem is solved and I get exactly the textfile that I want with the results I'm looking for. Along with some macros, here is what I'm entering into my Makefile: # The executable for the unit test for the evolution module unittest: testtimestep.o params.o loops.o $(CC) -o unittest testtimestep.o params.o loops.o # Create the object files params.o: params.cc $(CC) $(CFLAGS) -o params.o params.cc loops.o: loops.cc params.h $(CC) $(CFLAGS) -o loops.o loops.cc testtimestep.o: testtimestep.cc params.h $(CC) $(CFLAGS) -o testtimestep.o testtimestep.cc My apologies about the reproducible example thing. I've only started coding in c++ a month ago and besides writing some easy loops codes in Matlab I have no coding experience. This assignment I'm working on is made up of several very huge .cc files and it would be very overwhelming to post them all and explain what each one is doing. The params.h contains the following: // Preprocessor guards #ifndef PARAMS_H #define PARAMS_H #include <string> // List of all parameters and functions used by main.cc and loops.cc whose // assignments are stored in params.cc extern double c; extern double tau; extern double x1; extern double x2; extern double runtime; extern double dx; extern double outtime; extern std::string outfilename; extern void readParams(char* inputname); extern void derParams(); extern int ngrid; extern int npnts; extern double dt; extern int nsteps; extern int nper;
Subscribe to:
Post Comments (Atom)
|
No comments:
Post a Comment