# unexpected result with mcmodel=medium

**URL:** <https://forums.developer.nvidia.com/t/unexpected-result-with-mcmodel-medium/130739>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [June 4, 2007, 4:09pm UTC](https://forums.developer.nvidia.com/t/unexpected-result-with-mcmodel-medium/130739 "2007-06-04T16:09:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![WillDan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@WillDan](https://forums.developer.nvidia.com/u/WillDan)\
**Post date:** [June 4, 2007, 4:09pm UTC](https://forums.developer.nvidia.com/t/unexpected-result-with-mcmodel-medium/130739/1 "2007-06-04T16:09:53Z")

</div>

Hi,

I’ve got a bunch of code that compile and run well both with or without -mcmodel=medium.  
However with mcmodel=medium, it gives completely false results in some cases. I don’t really know where to begin to debug that… any clue I can follow?

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [June 4, 2007, 6:58pm UTC](https://forums.developer.nvidia.com/t/unexpected-result-with-mcmodel-medium/130739/2 "2007-06-04T18:58:01Z")

</div>

Hi WillDan,

Do the false results occur with the same datasets or do they only occur on datasets that need the medium memory model?

Since you’re able to compile without “-mcmodel=medium”, you code most likely doesn’t require it’s use. Can you try compiling with “-Mlarge\_arrays” instead? The main difference is that “-mcmodel=medium” allows your programs total data size (things like static arrays and local variables) to be greater than 2GB. While “-Mlarge\_arrays” allows allocated arrays to be larger than 2GB.

If your only getting false results on datasets that need large arrays, the first thing to check is if your index variables are integer_8. The default is integer_4.

- Mat

---

<div class="post-metadata">

**Author:** ![WillDan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@WillDan](https://forums.developer.nvidia.com/u/WillDan)\
**Post date:** [June 4, 2007, 7:30pm UTC](https://forums.developer.nvidia.com/t/unexpected-result-with-mcmodel-medium/130739/3 "2007-06-04T19:30:49Z")

</div>

by the way the dataset I used does not require mcmodel=medium, it’s just a test case but I expected the mcmodel=medium version to give an identical result. I compiled with -Mlarge\_arrays but it also give a false result (not the same one though :) )

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [June 5, 2007, 7:34pm UTC](https://forums.developer.nvidia.com/t/unexpected-result-with-mcmodel-medium/130739/4 "2007-06-05T19:34:50Z")

</div>

Hi WillDan,

I’m really sure then since you shouldn’t see a difference in answers with and without -mcmodel=medium. You may need to get out the debugger and try and track down where the problem is. Also, if you can put together an example, please feel free to send it to customer service at [trs@pgroup.com](mailto:trs@pgroup.com).

- Mat
