|
Zombywuf posted:Depressing isn't it? But java doesn't have function pointers!
|
# ? Jun 15, 2011 23:41 |
|
|
# ? May 30, 2024 13:41 |
|
I'm working on a pet project and I've run in to a bit of trouble. What I am trying to do is take the right ascension and declination of a celestial object and transpose those angles into Cartesian space. The tricky bit is trying to figure out the maths for the translations. The declination angle can be used to determine a point on the z-y plane, but then I need to rotate that point around the y-axis given the right ascension angle. Figure that I am trying to plot a sphere in x-y-z space. Any ideas?
|
# ? Jun 16, 2011 06:50 |
|
Woodsy Owl posted:I'm working on a pet project and I've run in to a bit of trouble. What I am trying to do is take the right ascension and declination of a celestial object and transpose those angles into Cartesian space. Well, for starters, you also need a radius before you can plot that in Cartesian space. Let's assume a radius of r, a right ascension of a (0 to 2*pi) and a declination of d (-pi/2 to pi/2). Let's also assume that d=0 leaves you in the x-y plane, and a=0 leaves you pointed directly along the x-axis in the positive direction. With no rotations applied at all, your position is (x=r, y=0, z=0). Applying right ascension, your position is now (x=r*cos(a), y=r*sin(a), z=0). Applying declination, your position is now (x=r*cos(a)*cos(d), y=r*sin(a)*cos(d), z=r*sin(d)). I have a neat little diagram here which I can scan and upload if need be.
|
# ? Jun 16, 2011 10:54 |
|
Small XHTML/CSS question here. If you go to http://de-raedt.eu/fomsitenew/ and hover over the menu, the submenu background (red in this case for troubleshooting) should start at the bottom white border of the navigation. In Chrome this works fine, but if you hover over it in Firefox the background is nudged upwards 3 pixels, which makes it end up kind of inside the navigation. Screenshot below for comparison! http://gyazo.com/9841bcbd058c7ffccfaab37f08325411
|
# ? Jun 16, 2011 16:33 |
|
I've been banging my head against this all morning. I'm trying to write a simple GreaseMonkey script to remove one row from a table. I've tried several variations of code, but nothing will do what I want. Here's the latest revision, based on searches in the GreaseMonkey forums.code:
code:
|
# ? Jun 16, 2011 18:59 |
|
qntm posted:Well, for starters, you also need a radius before you can plot that in Cartesian space. Let's assume a radius of r, a right ascension of a (0 to 2*pi) and a declination of d (-pi/2 to pi/2). Let's also assume that d=0 leaves you in the x-y plane, and a=0 leaves you pointed directly along the x-axis in the positive direction. I figured out an elegant solution. When I am computing the position on the x-z plane I need to multiply by cos(dec) to scale the vector components. Essentially what I am doing is drawing concentric rings about the y-axis and scaling them accordingly.
|
# ? Jun 16, 2011 20:52 |
|
I am looking to write some Java classes/methods in Eclipse and have them run in my team's Visual Studio C++ application. Now, I know I can just make a Jar file out of my functions and run them, but the Jar files execute the static void main---which means it will not return any values. I would like be able to run my java methods in C++ and have it return values. So I am wondering what the best way to do this is. I understand it may come down to some type of shell, but I just can't figure out what. I'd like it to hopefully be very simple, not require a lot of steps. Something standard and straightforward (hard to find on Google). Also, ideally, is there a way to get my C++ functions to talk with Java also? Specifically, I compile my Matlab code into C++ shared libraries, so I have the working .DLL's and .H files, but without some kind of shell, they won't work with Java. I understand this may interfere with cross-compatibility. That is okay, not an issue. Just want to get this one thing happening.
|
# ? Jun 16, 2011 21:46 |
|
cannibustacap posted:I am looking to write some Java classes/methods in Eclipse and have them run in my team's Visual Studio C++ application. The easiest method by far will be to have one process kick off the other from the command line, and read the appropriate output from a file. Edit: You can look into other interprocess communication mechanisms like sockets or shared memory, but all of them are basically a more complicated version of reading/writing from files.
|
# ? Jun 16, 2011 21:52 |
|
qntm posted:Well, for starters, you also need a radius before you can plot that in Cartesian space. Let's assume a radius of r, a right ascension of a (0 to 2*pi) and a declination of d (-pi/2 to pi/2). Let's also assume that d=0 leaves you in the x-y plane, and a=0 leaves you pointed directly along the x-axis in the positive direction. Thanks for your help but I worked this out on paper last night and confirmed functionality today. x = cos(declination) * cos(ascension) * scale_factor y = sin(declination) * scale_factor z = cos(declination) * sin(ascension) * scale_factor
|
# ? Jun 16, 2011 22:17 |
|
cannibustacap posted:Also, ideally, is there a way to get my C++ functions to talk with Java also? Specifically, I compile my Matlab code into C++ shared libraries, so I have the working .DLL's and .H files, but without some kind of shell, they won't work with Java.
|
# ? Jun 16, 2011 22:20 |
cannibustacap posted:Also, ideally, is there a way to get my C++ functions to talk with Java also? Specifically, I compile my Matlab code into C++ shared libraries, so I have the working .DLL's and .H files, but without some kind of shell, they won't work with Java. Java Native Interface lets you call native code from Java. It's probably a lot of effort to make it work well.
|
|
# ? Jun 16, 2011 22:46 |
|
ultrafilter posted:The easiest method by far will be to have one process kick off the other from the command line, and read the appropriate output from a file. Thanks, my only concern with just making a simple .JAR file and run it through a command line is that it won't return values. I wish I could do a "static int main(String[] args)" type of thing and return output codes, but I can't... Or can I? As for Java Builder for Matlab, I agree, but I don't think my employer is going to buy it. :-/
|
# ? Jun 16, 2011 23:18 |
|
cannibustacap posted:Thanks, my only concern with just making a simple .JAR file and run it through a command line is that it won't return values. I think that if you do a System.exit(#number) that the number is returned to the process that invokes the jar. Or else you could println the stuff you want and simply read the output stream from your C++ app.
|
# ? Jun 16, 2011 23:26 |
|
MEAT TREAT posted:I think that if you do a System.exit(#number) that the number is returned to the process that invokes the jar. Or else you could println the stuff you want and simply read the output stream from your C++ app. Hmm.. I thought System.exit will destroy the calling program as well? That is what happens when I run my java methods directly from matlab at least... Hmm, maybe if the System.exit destroys the Runtime instance only, it won't hurt the C++ app that calls it?
|
# ? Jun 17, 2011 00:30 |
|
System.exit can only affect the JVM.
|
# ? Jun 17, 2011 01:32 |
|
Hey guys, as the poor IT schmuck at my company I'm charged with switching 300+ DHCP-using Windows XP workstations into Static IPs, preserving the same settings they had in DHCP. I'm sure there's a VB script or .bat file for something like this but I've been Googling for hours and anything I can find is trying to go from Static to DHCP, not regress backwards. I don't have two days to copy and paste everything from ipconfig on every workstation. If someone can find/write me a fully automated script that I can deploy with GPO I'll buy you platinum or paypal .
|
# ? Jun 17, 2011 21:56 |
|
I can't help with your query but I can think of another one: why the hell would you want to do that?!
|
# ? Jun 17, 2011 22:31 |
|
Basically we have to remove a DHCP server and there's no guarantee we can get a new one up due to the way our switches are configured, and we're not allowed to touch our switches. It's really stupid. I did find this .vbs to set all network connections to DHCP: code:
|
# ? Jun 17, 2011 22:48 |
|
I would suggest asking in the PowerShell thread; I don't have anything to back that up other than apparently PowerShell can do everything.
|
# ? Jun 17, 2011 22:52 |
|
Zero VGS posted:I did find this .vbs to set all network connections to DHCP: Did you look at the VBScript object documentation? There is an EnableStatic method that takes an IP address and a subnet. Collect the current IP and subnet on the machine before calling EnableStatic and use those as parameters. e: The comments on the EnableStatic method page are kinda funny. "I ran this remotely and it gave an error code! "
|
# ? Jun 17, 2011 23:22 |
|
Just to get a final, straight answer: I have a for loop that's thousands of iterations long. Inside the for loop it's pretty basic math, some very basic if/then logic, and each iteration is independent of each other. This is pretty much the perfect application for GPGPU computing, correct?
|
# ? Jun 20, 2011 14:35 |
|
mik posted:Just to get a final, straight answer:
|
# ? Jun 20, 2011 19:00 |
|
mik posted:Just to get a final, straight answer: If you can tell it the bolded part or it can figure that out then yes.
|
# ? Jun 20, 2011 19:35 |
|
Depending on how much of it there is, that "if/then logic" might tank his performance on a GPU. Branches are still handled by predicate-based execution, right?
|
# ? Jun 20, 2011 21:23 |
|
JawnV6 posted:Depending on how much of it there is, that "if/then logic" might tank his performance on a GPU. Branches are still handled by predicate-based execution, right? Uh, worst case scenario it executes both branches and conditional-moves the result, right? Maybe performance could be divide by two..
|
# ? Jun 20, 2011 22:29 |
|
shrughes posted:Uh, worst case scenario it executes both branches and conditional-moves the result, right? Maybe performance could be divide by two.. The hardware's significantly dumber than you're imagining. Every thread executes every instruction, divergent 'branches' executing are handled by predicates at the instruction level. For NVidia's CUDA, you have groups of 32 threads called a 'warp' that have identical code. So if you've got something like: code:
code:
It's easy to assume you couldn't do worse than 40-50%, but it's not hard to get a case where this will really hurt you. Maybe his if/then logic is a thousand instructions long, the 'flattened' code would result in a lot of execution units going idle for a long time if even one thread takes it. On a GPGPU the naive code port would be horrendous performance. You have to think of if/then branches in terms of "Will iterations within %32 of each other all branch the same?" and I don't think that's as plainly obvious as everyone else does. Just seemed like everyone's glossing over the most relevant detail he said to shout "embarrassingly parallel!" louder.
|
# ? Jun 21, 2011 02:03 |
|
JawnV6 posted:So when this lands on a GPU, if anyone takes that branch then every single execution unit is going through all 5 instructions. 40% of your potential throughput is wasted because of that if/then. If it's like predicated instructions on a CPU, I'm pretty sure that it's actually going to cost you the time to evaluate every single instruction regardless of the thread states. Otherwise it's just going to do the equivalent of a pipeline bubble. Given that the execution units can dispatch up to 5 instructions at once, it's possible that the branches can be interleaved to cost less than it otherwise would.
|
# ? Jun 21, 2011 14:37 |
|
I'm really not sure what you're saying. Strictly speaking about GPU's, the 'execution units' are too dumb to control the instruction stream. There's one instruction fetch unit for every group of 32 threads. Every one of those 32 threads has to be considering the same instruction, therefore if any of them diverge on a branch you're basically issuing nops on the other 31. There's no 'interleaving' there's no bubbles, there's just some EU's working and some lying idle while the threads they're held together with work on the other path. If everyone%32 takes the same direction on each branch this isn't an issue, every EU will be doing 'real' work on every tick.
|
# ? Jun 21, 2011 17:43 |
|
I'm playing around with machine learning before I start getting heavy into the network monitoring app I'm writing. What are some cool things to attempt with hidden Markov models that are more complicated than doing pattern analysis on Rock-Paper-Scissors or something?
|
# ? Jun 21, 2011 18:11 |
|
Man, I wish I knew anything about processors.
|
# ? Jun 21, 2011 19:56 |
|
Misogynist posted:I'm playing around with machine learning before I start getting heavy into the network monitoring app I'm writing. What are some cool things to attempt with hidden Markov models that are more complicated than doing pattern analysis on Rock-Paper-Scissors or something? There's a pretty large literature on financial modeling with HMMs. You can easily find data and some ideas if you go digging around.
|
# ? Jun 21, 2011 20:15 |
|
Misogynist posted:I'm playing around with machine learning before I start getting heavy into the network monitoring app I'm writing. What are some cool things to attempt with hidden Markov models that are more complicated than doing pattern analysis on Rock-Paper-Scissors or something? Predict which poster will post next.
|
# ? Jun 21, 2011 20:23 |
|
Interesting discussion on the implications of logic inside the GPU code. I can definitely cut down on the number of if/then branches that gets passed, if not eliminate them entirely, as the logic is essentially if A > B then keep computing else stop, not head down another path. I could even let it do the computation and pick out the elements I want to keep back in the host code. Basically I need to do: code:
mik fucked around with this message at 21:48 on Jun 21, 2011 |
# ? Jun 21, 2011 21:41 |
|
I'm honestly in the dark as far as ATI's implementation goes. I was strictly speaking about CUDA's handling of diverging branches. For all I know ATI cards handle branches like a champ and I'm completely off base. I definitely think you should learn one GPGPU flavor if only to understand the limitations and tradeoffs inherent in that choice. If the same sort of predicated execution is hampering your performance the required refactoring will be a learning experience. Looking at that code, the only thing the if/then is determining is the signs of the operands. You could compute each term outside, then have the if/then just doing a single computation (apply signs to operands) with everything else independent of it. So: code:
|
# ? Jun 21, 2011 22:09 |
|
ultrafilter posted:There's a pretty large literature on financial modeling with HMMs. You can easily find data and some ideas if you go digging around.
|
# ? Jun 22, 2011 00:05 |
|
JawnV6 posted:I'm really not sure what you're saying. Strictly speaking about GPU's, the 'execution units' are too dumb to control the instruction stream. There's one instruction fetch unit for every group of 32 threads. Every one of those 32 threads has to be considering the same instruction, therefore if any of them diverge on a branch you're basically issuing nops on the other 31. There's no 'interleaving' there's no bubbles, there's just some EU's working and some lying idle while the threads they're held together with work on the other path. I guess I'm probably a bit confused about the exact setup of the processors that the code is running on. From what I understand if half the threads take one path, then it halts execution of the other half, runs the first half to the point where they would converge and then starts the other half from where it left off. That's inevitably going to have some sort of overhead such as pipeline flushing. However if it's small enough then the instructions will be predicated instead, which is what I was referring to. In that case everything maintains the same PC and is given the same instruction. However only some threads actually execute that instruction based on their predicate registers while the others do nothing for the cycle. I was probably thinking too much of how Itanium handles predicates since it's also a predicated VLIW architecture. In that case, each instruction in the bundle can be predicated separately. So if you've got: code:
|
# ? Jun 22, 2011 03:36 |
|
Misogynist posted:I'm playing around with machine learning before I start getting heavy into the network monitoring app I'm writing. What are some cool things to attempt with hidden Markov models that are more complicated than doing pattern analysis on Rock-Paper-Scissors or something? Generative language models are fun. Grab some books off project Gutenberg to train it then run it generatively and see what comes out.
|
# ? Jun 22, 2011 04:41 |
|
JawnV6 posted:So: Is there a sign function? i.e: code:
|
# ? Jun 22, 2011 10:28 |
|
Nippashish posted:Generative language models are fun. Grab some books off project Gutenberg to train it then run it generatively and see what comes out.
|
# ? Jun 22, 2011 14:00 |
|
|
# ? May 30, 2024 13:41 |
|
1337JiveTurkey posted:However if it's small enough then the instructions will be predicated instead, which is what I was referring to. In that case everything maintains the same PC and is given the same instruction. However only some threads actually execute that instruction based on their predicate registers while the others do nothing for the cycle. 1337JiveTurkey posted:I was probably thinking too much of how Itanium handles predicates since it's also a predicated VLIW architecture. In that case, each instruction in the bundle can be predicated separately. So if you've got: Zombywuf posted:Is there a sign function? i.e:
|
# ? Jun 22, 2011 18:15 |