I need to correct myself: You CANNOT use @inbounds before a function.
Julia will accept it, but it will be silently discarded. You need to
use @inbounds inside of functions.

@fastmath is different; you CAN use @fastmath before a function.

-erik


On Tue, Jan 20, 2015 at 12:20 PM, Erik Schnetter <[email protected]> wrote:
> `@inbounds` applies to everything that follows. You should even be able to 
> apply it to a module at once, or to use `begin`...`end` to apply it to 
> several statements at once. `@fastmath` behaves in a similar manner.
>
> `@simd`, however, needs to be applied directly to a single loop.
>
> -erik
>
>> On Jan 20, 2015, at 11:37 , Jacob Quinn <[email protected]> wrote:
>>
>> That all seems correct to me.
>>
>> -Jacob
>>
>> On Tue, Jan 20, 2015 at 9:36 AM, Nils Gudat <[email protected]> wrote:
>> Just a quick clarification on the @inbounds macro: I've seen it used both 
>> before and inside loops, like:
>>
>> @inbounds for i = 1:1000
>>   a = x[i]
>>   b = z[i]
>> end
>>
>> inbounds for i = 1:1000
>>   @inbounds a = x[i]
>>   @inbounds b = z[i]
>> end
>>
>> Would I be correct in assuming that both usages are valid and working and 
>> that the choice between the two basically boils down to whether I want to 
>> turn off bounds checking inside the entire loop (first case) or only for 
>> certain lines within the loop (second case)?
>
> --
> Erik Schnetter <[email protected]>
> http://www.perimeterinstitute.ca/personal/eschnetter/
>
> My email is as private as my paper mail. I therefore support encrypting
> and signing email messages. Get my PGP key from https://sks-keyservers.net.
>



-- 
Erik Schnetter <[email protected]>
http://www.perimeterinstitute.ca/personal/eschnetter/

Reply via email to