How to Convert OpenCL code from FP32 to FP16? [closed] - opencl

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
Is there a way to automatically convert a code that has been written to do FP32 calculations on a FP32 GPU, so it can do always FP16 calculations instead of FP32?
What I'm trying to achieve is to run a code for an old GPU(that doesn't support HALF Type), to run on a newer GPU that does... but without going through the code myself...
If not possible, show me some a light on what documentations should I read, to do it myself...
(new GPU is Radeon Vega Frontier, driver is ROCm 1.9.1, OS is Ubuntu 18.04)
(the code is extensive and composed by different modules... so I won't be posting it here, unless asked to)

No, there is no standard flag to say "treat float as half". You have to change "float" to "half". Also, your device must support fp16 calculations (many don't, just fp16 storage that converts to/from fp32 when you load/store). The cl_khr_fp16 extension adds support for half scalar and vector types as built-in types that can be used for arithmetic operations. You'll need a #prama in any kernels that use it.

Related

Is there a good date/time API available for Scala? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm looking for something akin to JodaTime or JSR 310 for Scala that leverages nice Scala features such as operator overloading and doesn't rely on implicit conversions (I have an irrational fear of implicit conversions).
I'm aware of http://github.com/jorgeortiz85/scala-time, but it just pimps JodaTime with implicits.
There's nothing wrong with implicit conversions. Even if a Java library wasn't used for the underlying logic, any sensibly designed pure Scala library would still use implicits, allowing you to write expressions such as 5.days + 3.minutes.
Not all implicits are created equal either, an implicit converting to a very specific type that you have full control over is almost certainly safe .
As others have already stated, such conversions will be optimised away in most cases, especially with escape analysis turned on, so don't let them worry you!
Until JSR 310 is finalised, joda-time is the best you're going to get.
Other than the need to follow Java naming conventions and a lack of operator overloading, joda-time is already a very good fit for idiomatic Scala. The design is very functional in nature, especially the way it embraces immutablity, so scalaj-time is actually only a very thin wrapper around the library.
You also get the benefit that scalaj-time can be easily upgraded to use JSR 310 when it's available, so it'll be much less painful to migrate your code at that time.
Since 2.8, scala-time has been renamed scalaj-time: http://github.com/scalaj/scalaj-time

Does an open-source poker-related math library exist? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I would like to develop a poker odds application that can give the probability of various game situations. Since the application will be mostly statistical analysis, I figured I would see if someone else had already written a library that implements the required mathematics.
I would prefer cross-platform open-source in C++, but that's not a requirement.
This is a subset of Dave's list, but I suggest you look at twodimes.net. It is a web app that uses the pokenum open source library. It is written in C. It does hand enumeration and stats for several poker varieties.
http://twodimes.net/poker/info/
Here's a list of poker-related software tools.
Complete source code for Texas hold'em poker game evaluator can be found here:
http://www.advancedmcode.org/poker-predictor.html
It is built for matlab, the GUI id m-coded but the computational engine is c++.
It allows for odds and probability calculation. It can deal, on my 2.4Ghz laptop, with a 100000 10 players game computation in 0,3 seconds.
An accurate real time computer:-)

Mapping widget for Qt [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I need a Qt widget that will allow me to display a map.
It needs to be able to:
Run without a network connection to a map or tile server. A simple bitmap would be fine.
Place widgets, lines and graphics on the map, given latitude and longitude.
Calculate distances between points.
Compile on Linux and Windows.
What would you suggest?
Thanks,
sqqqrly
I'd recommend taking a looking at Marble.
It's included with KDE-edu, but if I recall correctly, the Marble library does not have any dependencies beyond just Qt, it's also under the LGPL, and it's cross-platform. You should be able to place widgets and various other things on the surface.
Quantum GIS is the leader of the pack.
There is a map editor written for OpenStreetMap, which uses Qt.
http://www.merkaartor.org/
For map rendering they uses Webkit, I guess, but not really sure. Try to contact the author or read the source.
Hi every one QMapControl and ArcGIS could be a good try.

Is there an alternative to MKS Yacc that supports "selection preference syntax" or something very similar? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
MKS Yacc supports a notation which their web site calls "selection preference syntax". It isn't illustrated, but it consists of a token in square brackets, optionally with a caret, and it indicates that a particular token is required to follow, or is required not to follow, the rest of the rules:
non_terminal: TOKEN1 non_terminal2 TOKEN2 [TOKEN3]
non_terminal: TOKEN1 non_terminal2 TOKEN2 [^TOKEN3]
(I'm not clear whether the bracketed item can be a non-terminal. The code I've seen using the notation always uses a token or a couple of space separated tokens, and never a non-terminal.)
Is anyone aware of an alternative Yacc-compatible system (preferably open source) that provides the same support (notation can differ - functionality can't), running on Unix or Linux machines, preferably available in source format?
(MKS Yacc also provides some flexibility in handling errors and adjusting the error behaviour. One way in which that can be used is to treat keywords as identifiers when they are encountered in a position that makes no sense when they are treated as keywords. I was able to retrofit that into byacc - Berkeley Yacc - but I haven't spent enough time working out how to handle 'selection preferences'.)
See also: Has anyone used the "selection preference" mechanism provided by MKS Yacc?
Just for completeness, since I linked this in the answer to your other version, there appears to be a product from Thinkage called YAY, which is yacc-like and supports the selector syntax. They're in Kitchner and apparently closely associated with MKS, but from the website they also appear to be responsible for MKS's documentation, so maybe if all else fails you can call them as ask what the hell they meant by these selection preferences. ;-)

Looking for network link speed determination algorithm [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm looking for the best way to interpret the standard (well, standardish) Ethernet PHY registers, to determine the speed that an Ethernet link is actually running at. (e.g. 10/100/1000 and full/half-duplex)
I daresay that this is to be found in the source of things like Linux, and I'm just off to look there now, but if anyone has a good reference I'd be interested.
What I'm interested in is if it actually linked and what it linked at, rather than the vast sea of possibilities that each end has advertised at the outset.
Thanks for the answer. It's intended as a language and platform agnostic question, because pretty much all MII/GMII Ethernet PHYs have the same basic registers. I happen to be on an embedded platform.
But I found a sensible sequence which was good enough for my restricted application by looking at various bits of Linux driver source - it's basically:
Check for link-up in basic-status (0x1)
If the link's up then check for negotiation-complete in basic status (0x1)
If the negotiation's complete then check for 1G in the 1000M-status register (0xa)
If you've not got 1G, then you've got 100M. (That's not a general rule, but it applies in this application)
Maybe this was really a hardware question rather than a software one...
To help you looking at how the Linux kernel does it: While each driver can do its own thing, there is a generic version which is supposed to be used when the chip follows the standard closely enough: Generic Media Independent Interface device support.

Resources