我尝试在Android Studio中运行我的Hello World应用程序。我得到了以下错误:

模拟器:ERROR: x86仿真目前需要硬件 加速度! 请确保Intel HAXM已正确安装并可用。 CPU加速状态:HAX内核模块未安装!

你能告诉我如何处理这个错误吗?

最近谷歌和英特尔已经发布了一种新的方式来运行模拟器,这应该比以前的版本(已经模拟ARM CPU)更好。这里有一些关于它的链接:这个和这个。

但是,在安装新组件并按照指示创建新的模拟器配置之后,我得到一个错误,也看不到任何改进。我已经尝试了API 10和API 15, GPU启用和禁用。这些配置都没有帮助。我也在两台不同的电脑上尝试过,没有任何提升(而且出现了同样的错误)。

似乎在我读过的帖子中,没有人有任何问题,所有人都报告了一个更快的模拟器。

它显示的错误是:

emulator: Failed to open the HAX device!
HAX is not working and emulator runs in emulation mode
emulator: Open HAX device failed

为什么会发生这种情况,有办法解决吗?还有其他人得到这些错误吗?反之亦然?

顺便说一下,我有一个英特尔的CPU,如果这有问题的话。


编辑:

这是我在BIOS中看到的,所以它应该是可用的…:

为了完成这项作业,我已经绞尽脑汁一个星期了,我希望这里有人能指引我走上正确的道路。让我从教练的指导开始:

Your assignment is the opposite of our first lab assignment, which was to optimize a prime number program. Your purpose in this assignment is to pessimize the program, i.e. make it run slower. Both of these are CPU-intensive programs. They take a few seconds to run on our lab PCs. You may not change the algorithm. To deoptimize the program, use your knowledge of how the Intel i7 pipeline operates. Imagine ways to re-order instruction paths to introduce WAR, RAW, and other hazards. Think of ways to minimize the effectiveness of the cache. Be diabolically incompetent.

作业要求在磨石或蒙特卡洛程序中进行选择。缓存效率注释大多只适用于Whetstone,但我选择了Monte-Carlo模拟程序:

// Un-modified baseline for pessimization, as given in the assignment
#include <algorithm>    // Needed for the "max" function
#include <cmath>
#include <iostream>

// A simple implementation of the Box-Muller algorithm, used to generate
// gaussian random numbers - necessary for the Monte Carlo method below
// Note that C++11 actually provides std::normal_distribution<> in 
// the <random> library, which can be used instead of this function
double gaussian_box_muller() {
  double x = 0.0;
  double y = 0.0;
  double euclid_sq = 0.0;

  // Continue generating two uniform random variables
  // until the square of their "euclidean distance" 
  // is less than unity
  do {
    x = 2.0 * rand() / static_cast<double>(RAND_MAX)-1;
    y = 2.0 * rand() / static_cast<double>(RAND_MAX)-1;
    euclid_sq = x*x + y*y;
  } while (euclid_sq >= 1.0);

  return x*sqrt(-2*log(euclid_sq)/euclid_sq);
}

// Pricing a European vanilla call option with a Monte Carlo method
double monte_carlo_call_price(const int& num_sims, const double& S, const double& K, const double& r, const double& v, const double& T) {
  double S_adjust = S * exp(T*(r-0.5*v*v));
  double S_cur = 0.0;
  double payoff_sum = 0.0;

  for (int i=0; i<num_sims; i++) {
    double gauss_bm = gaussian_box_muller();
    S_cur = S_adjust * exp(sqrt(v*v*T)*gauss_bm);
    payoff_sum += std::max(S_cur - K, 0.0);
  }

  return (payoff_sum / static_cast<double>(num_sims)) * exp(-r*T);
}

// Pricing a European vanilla put option with a Monte Carlo method
double monte_carlo_put_price(const int& num_sims, const double& S, const double& K, const double& r, const double& v, const double& T) {
  double S_adjust = S * exp(T*(r-0.5*v*v));
  double S_cur = 0.0;
  double payoff_sum = 0.0;

  for (int i=0; i<num_sims; i++) {
    double gauss_bm = gaussian_box_muller();
    S_cur = S_adjust * exp(sqrt(v*v*T)*gauss_bm);
    payoff_sum += std::max(K - S_cur, 0.0);
  }

  return (payoff_sum / static_cast<double>(num_sims)) * exp(-r*T);
}

int main(int argc, char **argv) {
  // First we create the parameter list                                                                               
  int num_sims = 10000000;   // Number of simulated asset paths                                                       
  double S = 100.0;  // Option price                                                                                  
  double K = 100.0;  // Strike price                                                                                  
  double r = 0.05;   // Risk-free rate (5%)                                                                           
  double v = 0.2;    // Volatility of the underlying (20%)                                                            
  double T = 1.0;    // One year until expiry                                                                         

  // Then we calculate the call/put values via Monte Carlo                                                                          
  double call = monte_carlo_call_price(num_sims, S, K, r, v, T);
  double put = monte_carlo_put_price(num_sims, S, K, r, v, T);

  // Finally we output the parameters and prices                                                                      
  std::cout << "Number of Paths: " << num_sims << std::endl;
  std::cout << "Underlying:      " << S << std::endl;
  std::cout << "Strike:          " << K << std::endl;
  std::cout << "Risk-Free Rate:  " << r << std::endl;
  std::cout << "Volatility:      " << v << std::endl;
  std::cout << "Maturity:        " << T << std::endl;

  std::cout << "Call Price:      " << call << std::endl;
  std::cout << "Put Price:       " << put << std::endl;

  return 0;
}

我所做的更改似乎增加了一秒钟的代码运行时间,但我不完全确定我可以在不添加代码的情况下更改什么来暂停管道。一个指向正确方向的点将是非常棒的,我感谢任何回复。


更新:布置这个作业的教授发布了一些细节

重点是:

这是一所社区大学第二学期的建筑课程(使用的是轩尼诗和帕特森的教科书)。 实验室的计算机有Haswell的cpu 学生们已经了解了CPUID指令和如何确定缓存大小,以及intrinsic和CLFLUSH指令。 任何编译器选项都是允许的,inline asm也是如此。 编写自己的平方根算法被认为是不合理的

Cowmoogun对元线程的评论表明,编译器优化可能是其中的一部分并不清楚,并假设-O0,运行时增加17%是合理的。

听起来作业的目标是让学生重新排列现有的作业,以减少指令级的并行性或类似的事情,但这并不是一件坏事,人们钻研得更深入,学得更多。


请记住,这是一个计算机体系结构问题,而不是一个关于如何使c++变慢的问题。

我试图将我的应用程序安装到Android L预览英特尔Atom虚拟设备,它失败了,错误:

INSTALL_FAILED_NO_MATCHING_ABIS

这是什么意思?

我用的是带有AMD处理器的Windows 8.1 pro。我安装了Android SDK和Eclipse。它可以工作,但问题是,当我创建AVD并启动时,它会显示这个错误:

模拟器:错误:x86仿真目前需要硬件加速! 请确保Intel HAXM已正确安装并可用。 CPU加速状态:HAX内核模块未安装!

我已经安装了英特尔Hardware_Accelerated_Execution_Manager,我已经从引导菜单中启用了虚拟调制,但它仍然不起作用。