Comments (21)
Yeah, that's the way to do it.
from slim.
Here is what has worked for me for a number of years on many platforms, in case it helps. This gives you milliseconds.
#include <chrono>
auto start = std::chrono::steady_clock::now(); // start timer
// do some work
auto end = std::chrono::steady_clock::now();
auto diff = end - start;
std::cout << "Elapsed time: " << std::chrono::duration <double, std::milli> (diff).count() << " ms" << std::endl;
from slim.
Looks like this worked @bhaller, no problem with the conda build on this tarball.
To get a working conda version out the best option would be to push out a point release on github. I'm in no hurry with this though, it's entirely up to your schedule. It would be nice to resolve the external GSL thing too (#66) also for packaging.
from slim.
Note from @molpopgen:
@bhaller -- you may want to try to include ctime.h instead of time.h so that you use std::time instead of time as the function call. Ideally, the build system would allow one to check for the existence of functions in different headers, but that is easier with autools than with cmake.
from slim.
from slim.
I have just committed a switch from "time.h" to . I get no warnings when building with this header change, despite having made no other code changes, on my own machine or on Travis-CI, but I won't be surprised if there are, as @molpopgen said, some spots where I have to switch to using a std:: time function instead; on some platforms the C-style functions automatically get set up to be pass-throughs to the std:: functions by the corresponding C++ header (which I think is perhaps the way it is supposed to be?), on other platforms they don't. So there might be a bit of shaking out yet to happen. But modulo that, perhaps this resolves the glibc issue, without having to add -lrt
. I'm not sure how to re-run @jeromekelleher 's conda-forge PR, but maybe it should now work, if using the newly committed SLiM?
from slim.
I'm only appreciating now that the problem was at link-time and not at compile time. (My head has been in C++ template land too long...).
If you want to avoid linking to lrt
, you may consider using the C++11 <chrono>
types? These may avoid the link-time issue as they are implemented as templates. I just read thru the GCC7 implementation, which is the current conda
compiler version, and std::high_resolution_clock
doesn't make use of the C function with the missing symbol. In fact, it isn't referred to at all in the header on my system.
from slim.
If you want to avoid linking to
lrt
, you may consider using the C++11<chrono>
types?
I did investigate those, and couldn't get them to work. I don't recall what the problem was, but I beat my head against the wall for a while and gave up.
Apropos of my previous comment: it turns out that commenting out all the includes for ctime doesn't even affect the build, on my machine; some other header must be including time.h or ctime, making my includes redundant (at least on my own machine; of course that might be different on a different machine). So I think the change I committed is unlikely to fix the problem in question, at least not reliably. Sorry, quite distracted over here as I'm teaching a workshop right now.
from slim.
Looking at steady_clock now, I think perhaps I recall my frustration. I want to implement an Eidos function that returns a monotonic clock time to the user as a float. But steady_clock::now() gives you a steady_clock::time_point, which I could find no way of converting into a number that I could return to the user. It occurs to me now, however, that I can perhaps just take a time-base with now() at launch, and then calculate durations relative to that time-base, perhaps giving me the numeric clock values I want. Then I have to convert those durations into seconds, and that ought to be what I want. I'll work on that, in between workshop queries. :->
from slim.
OK, I have now made a less obviously pointless commit. :-> I've moved over to C++ for clock()
(now std::clock()
), and have switched to std::chrono
for the monotonic clock stuff. I think the -lrt
linkage should no longer be necessary, maybe. @jeromekelleher , want to try it out?
from slim.
This should solve #63, too, right?
from slim.
This should solve #63, too, right?
That's the hope. I'm just waiting for confirmation that it does what I'm hoping, in the context of the conda-forge build, before I close this and #63.
from slim.
The updates sounds great. To try this out here, the simplest thing is to make a tarball of the code and put it on a webserver somewhere. I can edit the URL in the recipe to point to this new tarball just to see if it works.
from slim.
Sorry, by "here" I meant in the conda-forge PR.
from slim.
Hi @jeromekelleher. OK, I have uploaded a tarball of the sources to http://www.benhaller.com/slim/SLiM_conda_test.tar. Thanks! By the way (you also might care @petrelharp), I will be incommunicado for the next several days – laptop is going in for repairs, and for some reason my email only fetches properly if my laptop fetches it, so.
from slim.
I tried this in conda-forge/staged-recipes#10613 @bhaller, but the tarball doesn't have the right structure (it has full file system paths from your system). Can you make one that looks like the gzipped tarballs that are used on the GitHub releases page please?
from slim.
OK, I just put up a new one that looks the same to me; give that a try. (Same URL as before.) Thanks!
from slim.
Still not working I'm afraid. There's a lot of extra stuff in there and the root directory name is different. Also probably best to gzip it.
from slim.
Ah, didn't realize the root directory name had to match exactly; so it should be SLiM-3.3.1
? I have made that change. The extra stuff is macOS cruft; I think I have now excluded it. I have also gzipped it. The URL is now http://www.benhaller.com/slim/SLiM-3.3.1.tar.gz to match the GitHub filename for the current SLiM release. Hopefully this does the trick! Thanks!
from slim.
Awesome, thanks a bunch for doing this legwork @jeromekelleher. I'm not sure when I'll want to do a new release; I'll think about that. Perhaps soon, just to get this rolling. I think @brnorris03 might have the GSL issue on her radar.
from slim.
I'll mark this as closed since the other things mentioned are represented by separate issues. Note this fixes #63 also.
from slim.
Related Issues (20)
- 4.1 Memory Issue HOT 6
- SLiMgui should offer to load external script changes HOT 7
- Wrap Eidos code edition/analysis features into a proper language server. HOT 1
- Slim 4.1 core dumping on computing cluster HOT 19
- small bug in docs HOT 1
- missing parents when using addRecombinant() HOT 2
- "pretty" option for serialize() HOT 2
- Inconsistent global-variable behavior from `x = 1` versus `x = x + 1` HOT 11
- Compiling Eidos script. HOT 13
- Software depends on Qt patch version? HOT 7
- improve recipe 17.5 by using tspop or link_ancestors
- SLiM 4.2 release process HOT 23
- QtSLiM *Open Recipe* list is sorted lexicographically rather than naturally HOT 5
- "buffer overflow detected" when trying to install SLiM on Linux HOT 29
- provide `make test` functionality to run tests after building `slim` and `eidos`
- SLiM 4.2.1 release process HOT 11
- Name collision between binaries and directories prevents linking with `ld` on RHEL 8 HOT 4
- Ubuntu SLiM install error HOT 20
- SLiM 4.2.1 fc 3 release process HOT 9
- 4.2.2 release process HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slim.