Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Optimize for Speed [-O] can not work #77

Closed
LinMaris opened this issue Oct 2, 2018 · 6 comments
Closed

Optimize for Speed [-O] can not work #77

LinMaris opened this issue Oct 2, 2018 · 6 comments

Comments

@LinMaris
Copy link

LinMaris commented Oct 2, 2018

I can execute swift -O xx.swift by ternimal, and get correct result.
but when I follow this method, I configured my Xcode project.
Once I execute my project, I will get an error.

let x = Tensor<Float>([[1, 2], [3, 4]])
print(x)

image

Whether or not I set this, Optimize for Speed [-O] , TensorFlow can't work.

@dan-zheng
Copy link
Member

Which macOS toolchain did you download? I see eGPUOverrides in the error message, which makes me a bit suspicious.

@LinMaris
Copy link
Author

LinMaris commented Oct 2, 2018

I create a empty macOS project, and run it with default toolchain

[default] Unable to load Info.plist exceptions (eGPUOverrides)

It still prints in my console.
image

@rxwei
Copy link
Contributor

rxwei commented Oct 2, 2018

It appears that you used a Swift for TensorFlow development snapshot (which is correct), not the default toolchain.

Let me try to reproduce this and get back to you.

@LinMaris
Copy link
Author

LinMaris commented Oct 2, 2018

@rxwei
Firstly, No matter which toolchain I choose, this log still exist

[default] Unable to load Info.plist exceptions (eGPUOverrides)

Secondly, I choose this chain Swift for TensorFlow development snapshot 208-09-17, run this code. that will crash.

let x = Tensor<Float>([[1, 2], [3, 4]])
print(x)

image

@rxwei
Copy link
Contributor

rxwei commented Oct 2, 2018

I'm unable to reproduce this error. Here's how I set up a "Command Line Tool" project in Xcode in project settings:

  • Set "Runpath Search Paths" to
    /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-09-17-a.xctoolchain/usr/lib/swift/macosx
  • Set "Library Search Paths" to
    /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-09-17-a.xctoolchain/usr/lib/swift/macosx
  • Set "Swift Compiler - Code Generation" - "Optimization Level" to "Optimize for Speed [-O]"

Then I can build and run a trivial program in main.swift:

import TensorFlow

var x = Tensor<Float>([[1, 2], [3, 4]])

for _ in 1...5 {
  x += x  x
}

print(x)

@LinMaris
Copy link
Author

LinMaris commented Oct 3, 2018

@rxwei you are right, I set up a "Command Line Tool" project in Xcode and that works, NO Crash

I set up the "Cocoa app" project before. that crash. :)

thanks

@rxwei rxwei closed this as completed Oct 3, 2018
brettkoonce pushed a commit to brettkoonce/swift that referenced this issue Mar 14, 2019
7 characters that save us 800 Mb.

If we want to stick to Debian base images, let's move to `python:slim`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants