Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-20 Thread Brandon Allbery
On Wed, Mar 20, 2013 at 9:02 AM, Jesper Särnesjö wrote: > This solution seems to work perfectly for me. Since the foreign code > is allowed to run uninterrupted, the GPU switch happens, and since the > GUI actions stay on the main thread, the program's window responds to > keyboard and mouse inpu

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-20 Thread Jesper Särnesjö
On Tue, Mar 19, 2013 at 12:19 AM, Jesper Särnesjö wrote: > As I final note, I did learn that the GHC runtime generates SIGVTALRM > signals to cause the scheduler to switch contexts. Perhaps this > prevents GLFW from running properly? Looks like I'll need to brush up > on my dtrace. A bit of googl

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-20 Thread Jesper Särnesjö
On Tue, Mar 19, 2013 at 8:18 AM, Albert Y. C. Lai wrote: > On 13-03-18 09:19 AM, Jesper Särnesjö wrote: >> >> Interestingly, running the program in GHCi with the -fno-ghci-sandbox >> flag, causes it to misbehave in the same way as when compiled: > > Then perhaps to mimic default ghci in hope of ge

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-18 Thread Albert Y. C. Lai
On 13-03-18 09:19 AM, Jesper Särnesjö wrote: Interestingly, running the program in GHCi with the -fno-ghci-sandbox flag, causes it to misbehave in the same way as when compiled: Then perhaps to mimic default ghci in hope of getting good results: - compile with -threaded (more candidly, link wi

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-18 Thread Carter Schonwald
Hey Jesper, thanks for the headsup! please continue to share you findings on this matter, It sounds like it'll be really useful for folks! -Carter On Mon, Mar 18, 2013 at 9:19 AM, Jesper Särnesjö wrote: > On Mon, Mar 18, 2013 at 11:27 AM, Brandon Allbery > wrote: > > On Sun, Mar 17, 2013 at

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-18 Thread Jesper Särnesjö
On Mon, Mar 18, 2013 at 11:27 AM, Brandon Allbery wrote: > On Sun, Mar 17, 2013 at 7:58 PM, Jason Dagit wrote: >> On Sat, Mar 16, 2013 at 6:53 PM, Jesper Särnesjö >> >>> To be clear, I think this isn't really an OpenGL problem, but rather >>> one related to FFI or event handling. If anyone could

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-17 Thread Brandon Allbery
On Sun, Mar 17, 2013 at 7:58 PM, Jason Dagit wrote: > On Sat, Mar 16, 2013 at 6:53 PM, Jesper Särnesjö wrote: > >> To be clear, I think this isn't really an OpenGL problem, but rather >> one related to FFI or event handling. If anyone could explain to me,The >> release notes for 7.0.1 said this a

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-17 Thread Jason Dagit
On Sat, Mar 16, 2013 at 6:53 PM, Jesper Särnesjö wrote: > > To be clear, I think this isn't really an OpenGL problem, but rather > one related to FFI or event handling. If anyone could explain to me, > in general, how and why a call to a foreign function returning IO () > might cause different be

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-17 Thread John Lato
Hello, Unfortunately I don't have much to add. On Wed, Mar 13, 2013 at 9:51 PM, Jesper Särnesjö wrote: > Hi everybody, > > This started out on haskell-beginners, as a question about poor > performance for a Haskell program using OpenGL. Thanks to a few good > suggestions there, I've managed to

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-17 Thread Carter Schonwald
Hey Jesper: hrm... have you tried other compilation / ffi choices that can influence the function call? eg: using the "safe" rather than "unsafe" modifier? http://www.haskell.org/haskellwiki/GHC/Using_the_FFI#Introduction (the safe modifier doesn't seem like it matters here, but its a simple exper

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-16 Thread Jesper Särnesjö
On Thu, Mar 14, 2013 at 12:51 AM, Jesper Särnesjö wrote: > In short, I have two programs, one written in Haskell [1] and one > written in C [2], that consist of calls to the same functions, in the > same order, to the same C library, but which do not exhibit the same > behavior. Further, the Haske

[Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-13 Thread Jesper Särnesjö
Hi everybody, This started out on haskell-beginners, as a question about poor performance for a Haskell program using OpenGL. Thanks to a few good suggestions there, I've managed to figure out more or less what the underlying problem is, but not its cause. In short, I have two programs, one writt