mex

糟心的caffe+ matlab编译路程

时间秒杀一切 提交于 2021-02-16 14:12:18
####配置:Ubuntu16.04+MatlabR2016b+cuda8.0+cudnn5.1+caffe 配置caffe真的不是很容易,特别是对初次接触Linux的同学,各种报错(ノ_;\( `ロ´),搞了好几天才解决 caffe安装可能出现的问题 ####可能会出现的问题 问题1."libcudart.so.8.0 cannot open shared object file: No such file or directory" 解决方法: 解决办法是将一些文件复制到/usr/local/lib文件夹下: 注意自己CUDA的版本号! sudo cp /usr/local/cuda-8.0/lib64/libcudart.so.8.0 /usr/local/lib/libcudart.so.8.0 && sudo ldconfig sudo cp /usr/local/cuda-8.0/lib64/libcublas.so.8.0 /usr/local/lib/libcublas.so.8.0 && sudo ldconfig sudo cp /usr/local/cuda-8.0/lib64/libcurand.so.8.0 /usr/local/lib/libcurand.so.8.0 && sudo ldconfig 问题2."libcudnn.so.5 cannot

Codeforces Round #466 (Div. 2) Solution

↘锁芯ラ 提交于 2021-02-15 06:03:27
从这里开始 题目列表 Problem A Points on the line Problem B Our Tanya is Crying Out Loud Problem C Phone Numbers Problem D Alena And The Heater Problem E Cashback Problem F Machine Learning Codeforces 940A Points on the line 题目大意   定义一个可重集的距离是它中间最大的两个数之间的差,特殊地,只有一个元素的可重集的距离为0。   给定一个可重集,问最少删掉多少个数使得它的距离小于等于d。   排序后单调指针扫,或者直接开桶计数。 Code 1 /* * 2 * Codeforces 3 * Problem#940A 4 * Accepted 5 * Time: 15ms 6 * Memory: 2000k 7 */ 8 #include <bits/stdc++.h> 9 using namespace std; 10 typedef bool boolean; 11 12 int n, d; 13 int res; 14 int * ar; 15 16 inline void init() { 17 scanf( " %d%d " , &n, & d); 18 ar =

Huge fort.# files when running gfortran

自闭症网瘾萝莉.ら 提交于 2021-02-15 03:13:46
问题 I am using gfortran for an application and running the Fortran through a Matlab mex file. I have noticed that in the current directory when I run the Fortran file, on my mac, it creates a fort.9 or fort.16 file, where the 9 or 16 are some arbitrary number. Recently, I have noticed that these fort. files can be GBs big! Generally they are quite small, like a few kBs. I was just wondering what purpose these files have? And second, is there some error I have in my code that is causing them to be

Dynamic parameterization of Armadillo matrix dimensions in C++

拥有回忆 提交于 2021-02-13 05:45:06
问题 The title summarizes the goal that is more exactly to dynamically retrieve the number of dimensions of MATLAB arrays passed to armadillo matrices. I would like to change the second and third arguments of mY() and mD() to parametric ones below. // mat(ptr_aux_mem, n_rows, n_cols, copy_aux_mem = true, strict = false) arma::mat mY(&dY[0], 2, 168, false); arma::mat mD(&dD[0], 2, 168, false); This must be definitely a common use case, but I still could not find a nice way of achieving it for the

Dynamic parameterization of Armadillo matrix dimensions in C++

半城伤御伤魂 提交于 2021-02-13 05:43:47
问题 The title summarizes the goal that is more exactly to dynamically retrieve the number of dimensions of MATLAB arrays passed to armadillo matrices. I would like to change the second and third arguments of mY() and mD() to parametric ones below. // mat(ptr_aux_mem, n_rows, n_cols, copy_aux_mem = true, strict = false) arma::mat mY(&dY[0], 2, 168, false); arma::mat mD(&dD[0], 2, 168, false); This must be definitely a common use case, but I still could not find a nice way of achieving it for the

Dynamic parameterization of Armadillo matrix dimensions in C++

放肆的年华 提交于 2021-02-13 05:42:10
问题 The title summarizes the goal that is more exactly to dynamically retrieve the number of dimensions of MATLAB arrays passed to armadillo matrices. I would like to change the second and third arguments of mY() and mD() to parametric ones below. // mat(ptr_aux_mem, n_rows, n_cols, copy_aux_mem = true, strict = false) arma::mat mY(&dY[0], 2, 168, false); arma::mat mD(&dD[0], 2, 168, false); This must be definitely a common use case, but I still could not find a nice way of achieving it for the

How can I specify a minimum compute capability to the mexcuda compiler to compile a mexfunction?

匆匆过客 提交于 2021-02-05 08:19:29
问题 I have a CUDA project in a .cu file that I would like to compile to a .mex file using mexcuda . Because my code makes use of the 64-bit floating point atomic operation atomicAdd(double *, double) , which is only supposed for GPU devices of compute capability 6.0 or higher, I need to specify this as a flag when I am compiling. In my standard IDE, this works fine, but when compiling with mexcuda , this is not working as I would like. In this post on MathWorks, it was suggested to use the

MATLAB - Error compiling jpeg_read.c to create mexmaci64 file

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-05 07:57:05
问题 recently I moved my Matlab project from windows OS to Mac OS. so my jpeg_read.mexw64 file didn't work anymore and I needed to create a new mexmaci64 file that is compatible with Mac OS. I Downloaded JpegToolbox from here and then installed Libjpeg using: brew install libjpeg in Matlab I tried to use mex: >> mex -setup MEX configured to use 'Xcode with Clang' for C language compilation. To choose a different language, select one from the following: mex -setup C++ mex -setup FORTRAN MEX

简单博弈论总结

本秂侑毒 提交于 2021-02-01 03:01:32
简单博弈论 本次简单博弈论讲解五个知识点: 1:bash博弈;2:nim博弈;3:威佐夫博弈;4:Fibonacci博弈;5:sg函数; 首先介绍博弈论问题有如下几个特点 1:博弈模型为两人轮流决策的博弈。并且两人都使用最优策略来取得胜利。 两个玩家,都会采取最优的决策,那么如果存在一个局面为必胜局面,某玩家位于此局面。只要自己无失误,则必胜。那么同样又一个局面为必败局面,某玩家位于此局面。只要对手无失误,则必败。 那也就是说,针对这样的游戏,我们关注点应该在局面上。 2:博弈是有限的。即无论两人如何决策,都会在有限步决出胜负。 3:博弈是公平的。即两人进行决策的规则相同。 相关概念: 先手必胜状态:先手可以从这个状态走到某一个必败状态。 先手必败状态:先手走不到任何一个必败状态。 也就是说先手必胜状态,那么先手一定能采取某些操作,让后手面对必败态。如果是先手必败态,无论先手怎么操作,都无法让后手面对必败态。 bash博弈 假设一堆石子有n个,每次最多取m个,甲乙两个玩家轮流取石子,最后把石子取完的人获胜,保证甲乙每一步的决策都是最优的,请问给定n和m,问甲胜还是乙胜。 不妨假设刚刚开始 n = m + 1 ,那么后手必胜,有如下结论: 令 n = ( m + 1 ) * r + s 其中 (r > 1,0 <= s < m + 1) 。如果s=0的话,先手每次取k个,后手只要取

How do you print to console in a Multi-Threaded MEX Function?

巧了我就是萌 提交于 2021-01-28 00:19:17
问题 I'm writing a simple producer consumer MEX function which uses the Boost library. I have manged to get the following program to work without any issues. #include "mex.h" #include <boost/thread/thread.hpp> #include <boost/lockfree/spsc_queue.hpp> #include <iostream> #include <boost/atomic.hpp> int producer_count = 0; boost::atomic_int consumer_count (0); boost::lockfree::spsc_queue<int, boost::lockfree::capacity<1024> > spsc_queue; const int iterations = 10000000; void producer() { for (int i