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 tre...@vex.net 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

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ö sarne...@gmail.com 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.

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ö sarne...@gmail.com 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

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 allber...@gmail.com wrote: On Sun, Mar 17, 2013 at 7:58 PM, Jason Dagit dag...@gmail.com wrote: On Sat, Mar 16, 2013 at 6:53 PM, Jesper Särnesjö sarne...@gmail.com wrote: To be clear, I think this isn't really an OpenGL problem, but rather one

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ö sarne...@gmail.com wrote: On Mon, Mar 18, 2013 at 11:27 AM, Brandon Allbery allber...@gmail.com

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

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

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ö sarne...@gmail.com 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,

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ö sarne...@gmail.com 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

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 dag...@gmail.com wrote: On Sat, Mar 16, 2013 at 6:53 PM, Jesper Särnesjö sarne...@gmail.comwrote: 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

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ö sarne...@gmail.com 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.