How to run dgemms subroutine on mac computer

In summary, the conversation is about a person who wrote a program on their Mac to run the dgemul subroutine for matrix multiplication, but it doesn't recognize the function. They discuss using the accelerate framework and reference manual for help, but it turns out that LAPACK does not have a matrix-multiplication subroutine.
  • #1
missfangula
32
0

Homework Statement



I wrote a program to run the dgemul subroutine on my mac to find the matrix product for matrix a and matrix b, outputted as matrix c, just like the reference manual told me to. Being a mac user, I added the accelerate framework to the file which contain all the lapack stuff, but it does not recognize 'dgemul' as a function. Can someone please enlighten me as to what I am doing wrong? Below is the completed program.

Homework Equations


The Attempt at a Solution



#import <Foundation/Foundation.h>
#include <Accelerate/Accelerate.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

int main ()
{

double a[16] =
{
1.0, 2.0, 3.0, 4.0,
1.0, 2.0, 3.0, 4.0,
1.0, 2.0, 3.0, 4.0,
1.0, 2.0, 3.0, 4.0

};

double b[16] =
{
5.0, 4.0, 3.0, 2.0,
5.0, 4.0, 3.0, 2.0,
5.0, 4.0, 3.0, 2.0,
5.0, 4.0, 3.0, 2.0
};

double c[16] =
{
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0
};

int lda = 4;
int ldb = 4;
char transa = 'N';
char transb = 'N';
int ldc = 4;
int l = 4;
int m = 4;
int n = 4;

dgemul(a, lda, transa, b, ldb, transb, c, ldc, l, m, n);
int i;
for (i=0; i<16; ++i) printf("%5.10f\n", c);


return 0;
}


Thank you!
-miss fangula
 
Physics news on Phys.org
  • #2
sorry, i meant the dgemul subroutine in the title, not dgemms
 
  • #3
I took a quick look at lapack and didn't see a routine called dgemul included.
 
  • #5
what subroutine should i call to do a matrix-matrix product?
 
  • #6

Related to How to run dgemms subroutine on mac computer

1. How do I install the dgemms subroutine on my mac computer?

To install the dgemms subroutine on your mac computer, you will need to download and install a software package such as CLAPACK or LAPACK. These packages include the necessary libraries and headers for dgemms to run. You will also need to make sure that your compiler is compatible with these packages.

2. What are the system requirements for running dgemms on a mac computer?

The system requirements for running dgemms on a mac computer will vary depending on the specific software package you are using. However, in general, you will need a mac computer with a compatible compiler (such as GCC or Intel Fortran) and enough memory and storage to run the dgemms subroutine.

3. How do I call the dgemms subroutine in my code?

To call the dgemms subroutine in your code, you will need to include the appropriate header file (such as cblas.h) and link to the necessary libraries. Then, you can use the function call dgemms() with the appropriate parameters to perform matrix multiplication.

4. Can I run dgemms on multiple cores or processors on my mac computer?

Yes, you can run dgemms on multiple cores or processors on your mac computer by using a parallel programming model such as OpenMP or MPI. These models allow for the distribution of work across multiple cores or processors, potentially improving the performance of dgemms.

5. Are there any common errors or issues when running dgemms on a mac computer?

One common error when running dgemms on a mac computer is related to compatibility between the compiler and software packages. Make sure to check the compatibility of your compiler and packages before attempting to run dgemms. Additionally, make sure to properly link to the necessary libraries and headers in your code.

Similar threads

  • Nuclear Engineering
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
5K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
0
Views
2K
  • Programming and Computer Science
Replies
4
Views
13K
  • Programming and Computer Science
Replies
23
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
2K
  • Programming and Computer Science
Replies
6
Views
2K
Back
Top