-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into mega-merge-json-apis
- Loading branch information
Showing
58 changed files
with
1,669 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// Copyright 2019-2023 Lawrence Livermore National Security, LLC and other | ||
// Variorum Project Developers. See the top-level LICENSE file for details. | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#include <getopt.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#include <variorum.h> | ||
#include <variorum_topology.h> | ||
|
||
#ifdef SECOND_RUN | ||
static inline double do_work(int input) | ||
{ | ||
int i; | ||
double result = (double)input; | ||
|
||
for (i = 0; i < 100000; i++) | ||
{ | ||
result += i * result; | ||
} | ||
|
||
return result; | ||
} | ||
#endif | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
int ret; | ||
char *s = NULL; | ||
#ifdef SECOND_RUN | ||
int i; | ||
int size = 1E4; | ||
volatile double x = 0.0; | ||
#endif | ||
|
||
const char *usage = "Usage: %s [-h] [-v]\n"; | ||
int opt; | ||
while ((opt = getopt(argc, argv, "hv")) != -1) | ||
{ | ||
switch (opt) | ||
{ | ||
case 'h': | ||
printf(usage, argv[0]); | ||
return 0; | ||
case 'v': | ||
printf("%s\n", variorum_get_current_version()); | ||
return 0; | ||
default: | ||
fprintf(stderr, usage, argv[0]); | ||
return -1; | ||
} | ||
} | ||
ret = variorum_get_gpu_utilization_json(&s); | ||
if (ret != 0) | ||
{ | ||
printf("First run: JSON get node utilization failed!\n"); | ||
free(s); | ||
exit(-1); | ||
} | ||
|
||
/* Print the entire JSON object */ | ||
puts(s); | ||
|
||
#ifdef SECOND_RUN | ||
for (i = 0; i < size; i++) | ||
{ | ||
x += do_work(i); | ||
} | ||
printf("Final result: %f\n", x); | ||
ret = variorum_get_gpu_utilization_json(&s); | ||
if (ret != 0) | ||
{ | ||
printf("Second run: JSON get node utilization failed!\n"); | ||
free(s); | ||
exit(-1); | ||
} | ||
|
||
/* Print the entire JSON object */ | ||
puts(s); | ||
#endif | ||
|
||
/* Deallocate the string */ | ||
free(s); | ||
|
||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2019-2023 Lawrence Livermore National Security, LLC and other | ||
// Variorum Project Developers. See the top-level LICENSE file for details. | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#include <getopt.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#include <variorum.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
int ret; | ||
|
||
const char *usage = "Usage: %s [-h] [-v]\n"; | ||
int opt; | ||
while ((opt = getopt(argc, argv, "hv")) != -1) | ||
{ | ||
switch (opt) | ||
{ | ||
case 'h': | ||
printf(usage, argv[0]); | ||
return 0; | ||
case 'v': | ||
printf("%s\n", variorum_get_current_version()); | ||
return 0; | ||
default: | ||
fprintf(stderr, usage, argv[0]); | ||
return -1; | ||
} | ||
} | ||
char *s = NULL; | ||
ret = variorum_get_node_frequency_json(&s); | ||
if (ret != 0) | ||
{ | ||
printf("Variorum get frequency json failure!\n"); | ||
free(s); | ||
exit(-1); | ||
} | ||
puts(s); | ||
free(s); | ||
|
||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// Copyright 2019-2023 Lawrence Livermore National Security, LLC and other | ||
// Variorum Project Developers. See the top-level LICENSE file for details. | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#include <getopt.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#include <variorum.h> | ||
#include <variorum_topology.h> | ||
|
||
#ifdef SECOND_RUN | ||
static inline double do_work(int input) | ||
{ | ||
int i; | ||
double result = (double)input; | ||
|
||
for (i = 0; i < 100000; i++) | ||
{ | ||
result += i * result; | ||
} | ||
|
||
return result; | ||
} | ||
#endif | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
int ret; | ||
char *s = NULL; | ||
#ifdef SECOND_RUN | ||
int i; | ||
int size = 1E4; | ||
volatile double x = 0.0; | ||
#endif | ||
|
||
const char *usage = "Usage: %s [-h] [-v]\n"; | ||
int opt; | ||
while ((opt = getopt(argc, argv, "hv")) != -1) | ||
{ | ||
switch (opt) | ||
{ | ||
case 'h': | ||
printf(usage, argv[0]); | ||
return 0; | ||
case 'v': | ||
printf("%s\n", variorum_get_current_version()); | ||
return 0; | ||
default: | ||
fprintf(stderr, usage, argv[0]); | ||
return -1; | ||
} | ||
} | ||
ret = variorum_get_node_utilization_json(&s); | ||
if (ret != 0) | ||
{ | ||
printf("First run: JSON get node utilization failed!\n"); | ||
free(s); | ||
exit(-1); | ||
} | ||
|
||
/* Print the entire JSON object */ | ||
puts(s); | ||
|
||
#ifdef SECOND_RUN | ||
for (i = 0; i < size; i++) | ||
{ | ||
x += do_work(i); | ||
} | ||
printf("Final result: %f\n", x); | ||
ret = variorum_get_node_utilization_json(&s); | ||
if (ret != 0) | ||
{ | ||
printf("Second run: JSON get node utilization failed!\n"); | ||
free(s); | ||
exit(-1); | ||
} | ||
|
||
/* Print the entire JSON object */ | ||
puts(s); | ||
#endif | ||
|
||
/* Deallocate the string */ | ||
free(s); | ||
|
||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.