This section deals with the specifics of compiling and linking your application with the MASS libraries.
To use MASS functions in your application, you need to include the appropriate MASS header(s) for the type of MASS function being used (for a complete list of MASS functions available, see Using the MASS scalar library, Using the MASS vector library, and Using the MASS SIMD library).
The default installation of MASS places the MASS headers in your default header search path. If you cannot find the MASS headers in your default search path, contact your system programmer.
The following examples demonstrate the relationship among MASS functions, headers, and libraries, and show how to use MASS in your source program.
/* Using the MASS-only scalar function 'rsqrt'
Compile command: xlc -qARCH=10 -qFLOAT=IEEE -c sample1.c
*/
#include <math.h>
#include <mass.h> /* The 'rsqrt' function is declared in <mass.h>, not <math.h> */
int main(void) {
double input = 16;
double output;
output = rsqrt(input);
/* ... Code to utilize the results in "output" goes here */
}
/* Using the MASS scalar function 'pow'
Compile command: xlc -qARCH=10 -qFLOAT=IEEE -c sample2.c
*/
#include <math.h> /* The 'pow' function is declared in <math.h>, not <mass.h> */
#include <mass.h>
int main(void) {
double base = 3;
double exponent = 2;
double output;
output = pow(base, exponent);
/* ... Code to utilize the results in "output" goes here */
}
/* Call the MASS vector function 'vlog2'
Compile command: xlc -qARCH=11 -qFLOAT=IEEE -c sample3.c
*/
#include <massv.h>
int main(void) {
int size = 1000;
double input[size];
double output[size];
input[0] = 8;
input[1] = 16;
...
input[999] = 42;
vlog2(output, input, &size);
/* ... Code to utilize the results in "output[]" goes here */
}
/* Call the MASS SIMD function 'powd2'
Compile command: xlc -qARCH=11 -qFLOAT=IEEE -qVECTOR -c sample4.c
*/
#include <mass_simd.h>
int main(void) {
vector double bases = {0, 1};
vector double exponents = {2, 2};
vector double output;
output = powd2(bases, exponents);
/* ... Code to utilize the results in "output" goes here */
}
/* Call the MASS scalar functions 'pow' and 'rsqrt', and
the vector function 'vlog10'
Compile command: xlc -qARCH=10 -qFLOAT=IEEE -c sample5.c
*/
#include <math.h> /* This includes the prototype for 'pow' */
#include <mass.h> /* This includes the prototype for 'rsqrt' */
#include <massv.h> /* This includes the prototype for 'vlog10' */
int main(void) {
int size = 1000;
double input[size];
double result[size];
int i;
for (i = 0; i < size; i++) {
input[i] = i; /* Trivially initialize the input vector */
}
vlog10(result, input, &size);
double output = pow(result[27], result[525]);
output = rsqrt(output);
/* ... Code to utilize the results in "output" goes here */
}
IBM provides the MASS library in both USS and MVS. There is no performance difference based on where the library resides. This is simply to allow USS users to link with MASS in USS, and MVS users to link with MASS in MVS.
Although USS users can link with the copy of the MASS libraries which resides in PDS's (and vice-versa), IBM does not recommend this because it does not provide a performance gain, and it adds unnecessary complexity to your build process.
Linking in USS
# Link the MASS-only scalar function 'rsqrt'.
# Assume 'sample1.o' was compiled with ARCHITECTURE(10).
xlc sample1.o -lmass.arch10
# Link the MASS scalar function 'pow'.
# Assume 'sample2.o' was compiled with ARCHITECTURE(10).
xlc sample2.o -lmass.arch10
# Link the MASS vector function 'vlog2'.
# Assume 'sample3.o' was compiled with ARCHITECTURE(11).
xlc sample3.o -lmassv.arch11
# Link the MASS SIMD function 'powd2'.
# Assume 'sample4.o' was compiled with ARCHITECTURE(11).
xlc sample4.o -lmass_simd.arch11
# Link the MASS scalar functions 'pow' and 'rsqrt', and
# the vector function 'vlog10'.
# Assume 'sample5.o' was compiled with ARCHITECTURE(10).
xlc sample5.o -lmass.arch10 -lmassv.arch10
Linking in MVS
//SYSLIB DD DSN=CEE.SCEELKEX,DISP=SHR
// DD DSN=CEE.SCEELKED,DISP=SHR
// DD DSN=CBC.SCCNOBJ,DISP=SHR
and you want
to link each of the sample programs presented above (using NOXPLINK),
here are the SYSLIB concatenations you would use: //SYSLIB DD DSN=CBC.SCCNN10,DISP=SHR
// DD DSN=CEE.SCEELKEX,DISP=SHR
// DD DSN=CEE.SCEELKED,DISP=SHR
// DD DSN=CBC.SCCNOBJ,DISP=SHR
//SYSLIB DD DSN=CBC.SCCNM10,DISP=SHR
// DD DSN=CEE.SCEELKEX,DISP=SHR
// DD DSN=CEE.SCEELKED,DISP=SHR
// DD DSN=CBC.SCCNOBJ,DISP=SHR
//SYSLIB DD DSN=CBC.SCCNN11,DISP=SHR
// DD DSN=CEE.SCEELKEX,DISP=SHR
// DD DSN=CEE.SCEELKED,DISP=SHR
// DD DSN=CBC.SCCNOBJ,DISP=SHR
//SYSLIB DD DSN=CBC.SCCNN11,DISP=SHR
// DD DSN=CEE.SCEELKEX,DISP=SHR
// DD DSN=CEE.SCEELKED,DISP=SHR
// DD DSN=CBC.SCCNOBJ,DISP=SHR
//SYSLIB DD DSN=CBC.SCCNM10,DISP=SHR
// DD DSN=CBC.SCCNN10,DISP=SHR
// DD DSN=CEE.SCEELKEX,DISP=SHR
// DD DSN=CEE.SCEELKED,DISP=SHR
// DD DSN=CBC.SCCNOBJ,DISP=SHR
//SYSLIB DD DSN=CEE.SCEEBND2,DISP=SHR
// DD DSN=CBC.SCCNOBJ